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 =       ctftest.ksh
  22 
  23 TESTS =         test-float.c \
  24                 test-reference.c \
  25                 test-int.c \
  26                 test-array.c \
  27                 test-enum.c \
  28                 test-forward.c \
  29                 test-sou.c \
  30                 test-function.c \
  31                 test-merge-static/Makefile.ctftest \
  32                 test-merge-static/test-a.c \
  33                 test-merge-static/test-b.c \
  34                 test-merge-static/test-c.c \
  35                 test-merge-static/test-d.c \
  36                 test-merge-static/test-main.c \
  37                 test-merge-forward/Makefile.ctftest \
  38                 test-merge-forward/test-impl.c \
  39                 test-merge-forward/test-merge.c \
  40                 test-merge-dedup/Makefile.ctftest \
  41                 test-merge-dedup/test-merge-1.c \
  42                 test-merge-dedup/test-merge-2.c \
  43                 test-merge-dedup/test-merge-3.c \
  44                 test-merge-dedup/test-merge-dedup.c \
  45                 test-merge-reduction/Makefile.ctftest \
  46                 test-merge-reduction/mapfile-vers \
  47                 test-merge-reduction/test-global.c \
  48                 test-merge-reduction/test-scoped.c \
  49                 test-merge-weak/Makefile.ctftest \
  50                 test-merge-weak/test-merge-weak.c \
  51                 test-weak.c \
  52                 Makefile.ctftest.com
  53 
  54 MAKEDIRS =      test-merge-static \
  55                 test-merge-forward \
  56                 test-merge-dedup \
  57                 test-merge-reduction \
  58                 test-merge-weak
  59 
  60 CHECKS =        check-float-32 \
  61                 check-float-64 \
  62                 check-int-32 \
  63                 check-int-64 \
  64                 check-reference \
  65                 check-array \
  66                 check-enum \
  67                 check-sou-32 \
  68                 check-sou-64 \
  69                 check-forward-32 \
  70                 check-forward-64 \
  71                 check-function \
  72                 check-merge-static \
  73                 check-merge-forward-32 \
  74                 check-merge-forward-64 \
  75                 check-merge-dedup \
  76                 check-merge-reduction \
  77                 check-merge-weak \
  78                 check-weak
  79 
  80 COMMON_OBJS =   check-common.o
  81 ALL_OBJS =      $(CHECKS:%=%.o) $(CHECKS:%-32=%.32.o) $(CHECKS:%-64=%.64.o) $(COMMON_OBJS)
  82 
  83 ROOTTESTS =     $(TESTS:%=$(TESTDIR)/%)
  84 ROOTMAKEDIRS =  $(MAKEDIRS:%=$(TESTDIR)/%)
  85 ROOTCHECKS =    $(CHECKS:%=$(TESTDIR)/%)
  86 ROOTSCRIPTS =   $(SCRIPTS:%.ksh=$(TESTDIR)/%)
  87 
  88 ROOTTESTS       := FILEMODE =   0444
  89 ROOTCHECKS      := FILEMODE =   0555
  90 ROOTSCRIPTS     := FILEMODE =   0555
  91 
  92 include $(SRC)/cmd/Makefile.cmd
  93 include $(SRC)/test/Makefile.com
  94 
  95 LDLIBS +=       -lctf
  96 
  97 check-merge-static :=   LDLIBS += -lelf
  98 
  99 all: $(CHECKS)
 100 
 101 install: all $(ROOTTESTS) $(ROOTCHECKS) $(ROOTSCRIPTS)
 102 
 103 $(CHECKS): $(COMMON_OBJS)
 104 
 105 clean:
 106         $(RM) $(ALL_OBJS)
 107 
 108 clobber: clean
 109         $(RM) $(CHECKS)
 110 
 111 $(ROOTTESTS): $(TESTDIR) $(ROOTMAKEDIRS) $(TESTS)
 112 $(ROOTCHECKS): $(TESTDIR) $(CHECKS)
 113 $(ROOTSCRIPTS): $(TESTDIR) $(SCRIPTS)
 114 
 115 $(TESTDIR):
 116         $(INS.dir)
 117 
 118 $(ROOTMAKEDIRS):
 119         $(INS.dir)
 120 
 121 $(TESTDIR)/%: %
 122         $(INS.file)
 123 
 124 $(TESTDIR)/%: %.ksh
 125         $(INS.rename)
 126 
 127 %.o: %.c
 128         $(COMPILE.c) -o $@ $<
 129         $(POST_PROCESS_O)
 130 
 131 %.32.o: %.c
 132         $(COMPILE.c) -o $@ $<
 133         $(POST_PROCESS_O)
 134 
 135 %.64.o: %.c
 136         $(COMPILE.c) -DTARGET_LP64 -o $@ $<
 137         $(POST_PROCESS_O)
 138 
 139 %-32: %.32.o
 140         $(LINK.c) -o $@ $< $(COMMON_OBJS) $(LDLIBS)
 141         $(POST_PROCESS)
 142 
 143 %-64: %.64.o
 144         $(LINK.c) -o $@ $< $(COMMON_OBJS) $(LDLIBS)
 145         $(POST_PROCESS)
 146 
 147 %: %.o
 148         $(LINK.c) -o $@ $< $(COMMON_OBJS) $(LDLIBS)
 149         $(POST_PROCESS)