1 #
   2 # This file and its contents are supplied under the terms of the
   3 # Common Development and Distribution License ("CDDL"), version 1.0.
   4 # You may only use this file in accordance with the terms of version
   5 # 1.0 of the CDDL.
   6 #
   7 # A full copy of the text of the CDDL should have accompanied this
   8 # source.  A copy of the CDDL is also available via the Internet at
   9 # http://www.illumos.org/license/CDDL.
  10 #
  11 
  12 #
  13 # Copyright (c) 2019, Joyent, Inc.
  14 #
  15 
  16 include $(SRC)/Makefile.master
  17 
  18 ROOTOPTPKG = $(ROOT)/opt/util-tests
  19 TESTDIR = $(ROOTOPTPKG)/tests/ctf
  20 
  21 SCRIPTS =       precheck.ksh \
  22                 ctftest.ksh \
  23                 ctftest-convert-non-c.ksh \
  24                 ctftest-convert-no-dwarf.ksh \
  25                 ctftest-merge-no-ctf.ksh \
  26 
  27 TESTS =         test-float.c \
  28                 test-reference.c \
  29                 test-int.c \
  30                 test-array.c \
  31                 test-enum.c \
  32                 test-forward.c \
  33                 test-sou.c \
  34                 test-function.c \
  35                 test-merge-static/Makefile.ctftest \
  36                 test-merge-static/test-a.c \
  37                 test-merge-static/test-b.c \
  38                 test-merge-static/test-c.c \
  39                 test-merge-static/test-d.c \
  40                 test-merge-static/test-main.c \
  41                 test-merge-forward/Makefile.ctftest \
  42                 test-merge-forward/test-impl.c \
  43                 test-merge-forward/test-merge.c \
  44                 test-merge-dedup/Makefile.ctftest \
  45                 test-merge-dedup/test-merge-1.c \
  46                 test-merge-dedup/test-merge-2.c \
  47                 test-merge-dedup/test-merge-3.c \
  48                 test-merge-dedup/test-merge-dedup.c \
  49                 test-merge-reduction/Makefile.ctftest \
  50                 test-merge-reduction/mapfile-vers \
  51                 test-merge-reduction/test-global.c \
  52                 test-merge-reduction/test-scoped.c \
  53                 test-merge-weak/Makefile.ctftest \
  54                 test-merge-weak/test-merge-weak.c \
  55                 test-weak.c \
  56                 Makefile.ctftest.com
  57 
  58 MAKEDIRS =      test-merge-static \
  59                 test-merge-forward \
  60                 test-merge-dedup \
  61                 test-merge-reduction \
  62                 test-merge-weak
  63 
  64 CHECKS =        check-float-32 \
  65                 check-float-64 \
  66                 check-int-32 \
  67                 check-int-64 \
  68                 check-reference \
  69                 check-array \
  70                 check-enum \
  71                 check-sou-32 \
  72                 check-sou-64 \
  73                 check-forward-32 \
  74                 check-forward-64 \
  75                 check-function \
  76                 check-merge-static \
  77                 check-merge-forward-32 \
  78                 check-merge-forward-64 \
  79                 check-merge-dedup \
  80                 check-merge-reduction \
  81                 check-merge-weak \
  82                 check-weak
  83 
  84 COMMON_OBJS =   check-common.o
  85 ALL_OBJS =      $(CHECKS:%=%.o) $(CHECKS:%-32=%.32.o) $(CHECKS:%-64=%.64.o) $(COMMON_OBJS)
  86 
  87 ROOTTESTS =     $(TESTS:%=$(TESTDIR)/%)
  88 ROOTMAKEDIRS =  $(MAKEDIRS:%=$(TESTDIR)/%)
  89 ROOTCHECKS =    $(CHECKS:%=$(TESTDIR)/%)
  90 ROOTSCRIPTS =   $(SCRIPTS:%.ksh=$(TESTDIR)/%)
  91 
  92 ROOTTESTS       := FILEMODE =   0444
  93 ROOTCHECKS      := FILEMODE =   0555
  94 ROOTSCRIPTS     := FILEMODE =   0555
  95 
  96 include $(SRC)/cmd/Makefile.cmd
  97 include $(SRC)/test/Makefile.com
  98 
  99 LDLIBS +=       -lctf
 100 
 101 check-merge-static :=   LDLIBS += -lelf
 102 
 103 all: $(CHECKS)
 104 
 105 install: all $(ROOTTESTS) $(ROOTCHECKS) $(ROOTSCRIPTS)
 106 
 107 $(CHECKS): $(COMMON_OBJS)
 108 
 109 clean:
 110         $(RM) $(ALL_OBJS)
 111 
 112 clobber: clean
 113         $(RM) $(CHECKS)
 114 
 115 $(ROOTTESTS): $(TESTDIR) $(ROOTMAKEDIRS) $(TESTS)
 116 $(ROOTCHECKS): $(TESTDIR) $(CHECKS)
 117 $(ROOTSCRIPTS): $(TESTDIR) $(SCRIPTS)
 118 
 119 $(TESTDIR):
 120         $(INS.dir)
 121 
 122 $(ROOTMAKEDIRS):
 123         $(INS.dir)
 124 
 125 $(TESTDIR)/%: %
 126         $(INS.file)
 127 
 128 $(TESTDIR)/%: %.ksh
 129         $(INS.rename)
 130 
 131 %.o: %.c
 132         $(COMPILE.c) -o $@ $<
 133         $(POST_PROCESS_O)
 134 
 135 %.32.o: %.c
 136         $(COMPILE.c) -o $@ $<
 137         $(POST_PROCESS_O)
 138 
 139 %.64.o: %.c
 140         $(COMPILE.c) -DTARGET_LP64 -o $@ $<
 141         $(POST_PROCESS_O)
 142 
 143 %-32: %.32.o
 144         $(LINK.c) -o $@ $< $(COMMON_OBJS) $(LDLIBS)
 145         $(POST_PROCESS)
 146 
 147 %-64: %.64.o
 148         $(LINK.c) -o $@ $< $(COMMON_OBJS) $(LDLIBS)
 149         $(POST_PROCESS)
 150 
 151 %: %.o
 152         $(LINK.c) -o $@ $< $(COMMON_OBJS) $(LDLIBS)
 153         $(POST_PROCESS)