Print this page
Commonize demangle test pieces; allow for running specific tests and test cases; use linker sets to simplify test definition

Split Close
Expand all
Collapse all
          --- old/usr/src/test/util-tests/tests/demangle/Makefile
          +++ new/usr/src/test/util-tests/tests/demangle/Makefile
↓ open down ↓ 8 lines elided ↑ open up ↑
   9    9  # http://www.illumos.org/license/CDDL.
  10   10  #
  11   11  
  12   12  #
  13   13  # Copyright 2018 Jason King.
  14   14  # Copyright 2019 Joyent, Inc.
  15   15  #
  16   16  
  17   17  include $(SRC)/Makefile.master
  18   18  include $(SRC)/cmd/Makefile.cmd
       19 +include $(SRC)/cmd/Makefile.ctf
  19   20  include $(SRC)/test/Makefile.com
  20   21  
  21   22  ROOTBINDIR = $(ROOTOPTPKG)/bin
  22   23  
  23      -PROG = gcc-libstdc++ llvm-stdcxxabi afl-fast rust
       24 +PROG = cxx rust
  24   25  
       26 +OBJS_common = main.o
       27 +OBJS_rust = rust.o
       28 +OBJS_cxx = afl-fast.o gcc-libstdc++.o llvm-stdcxxabi.o
       29 +
  25   30  ROOTOPTPKG = $(ROOT)/opt/util-tests
  26   31  TESTDIR = $(ROOTOPTPKG)/tests/demangle
  27   32  
  28   33  CMDS = $(PROG:%=$(TESTDIR)/%)
  29   34  $(CMDS) := FILEMODE = 0555
  30   35  
  31      -OBJS = $(PROG:%=%.o)
       36 +cxx := OBJS = $(OBJS_common) $(OBJS_cxx)
       37 +rust := OBJS = $(OBJS_common) $(OBJS_cxx)
       38 +
       39 +$(OBJS_rust) $(OBJS_cxx) := SMATCH = off
       40 +
  32   41  SRCS = $(OBJS:%.o=%.c)
  33   42  
  34   43  CSTD = $(CSTD_GNU99)
  35   44  
  36      -LDLIBS += -ldemangle-sys
  37      -rust := LDLIBS += -lumem
       45 +LDLIBS += -ldemangle-sys -lumem
  38   46  
  39   47  all: $(PROG)
  40   48  
  41      -gcc-libstdc++: gcc-libstdc++.o
  42      -        $(LINK.c) -o $@ gcc-libstdc++.o $(LDLIBS)
       49 +cxx: $(OBJS_common) $(OBJS_cxx)
       50 +        $(LINK.c) -o $@ $(OBJS_common) $(OBJS_cxx) $(LDLIBS)
  43   51          $(POST_PROCESS)
  44   52  
  45      -llvm-stdcxxabi: llvm-stdcxxabi.o
  46      -        $(LINK.c) -o $@ llvm-stdcxxabi.o $(LDLIBS)
       53 +rust: $(OBJS_rust)
       54 +        $(LINK.c) -o $@ $(OBJS_common) $(OBJS_rust) $(LDLIBS)
  47   55          $(POST_PROCESS)
  48   56  
  49      -afl-fast: afl-fast.o
  50      -        $(LINK.c) -o $@ afl-fast.o $(LDLIBS)
  51      -        $(POST_PROCESS)
  52      -
  53      -rust: rust.o
  54      -        $(LINK.c) -o $@ rust.o $(LDLIBS)
  55      -        $(POST_PROCESS)
  56      -
  57   57  install: all $(CMDS)
  58   58  
  59      -lint:
  60      -
  61   59  clobber: clean
  62   60          -$(RM) $(PROG)
  63   61  
  64   62  clean:
  65      -        -$(RM) $(OBJS)
       63 +        -$(RM) $(OBJ_common) $(OBJS_cxx) $(OBJS_rust)
  66   64  
  67   65  $(CMDS): $(TESTDIR) $(PROG)
  68   66  
  69   67  $(ROOTBINDIR):
  70   68          $(INS.dir)
  71   69  
  72   70  $(ROOTBINDIR)/%: %
  73   71          $(INS.file)
  74   72  
  75   73  $(TESTDIR):
  76   74          $(INS.dir)
  77   75  
  78   76  $(TESTDIR)/%: %
  79   77          $(INS.file)
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX