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) 2012 by Delphix. All rights reserved.
  14 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
  15 #
  16 
  17 include $(SRC)/Makefile.master
  18 include $(SRC)/cmd/Makefile.cmd
  19 include $(SRC)/test/Makefile.com
  20 
  21 $(OBJS_OVERRIDE)OBJS = $(PROG).o test_common.o
  22 OBJS32 = $(OBJS:%.o=%.$(MACH).o)
  23 PROG32 = $(PROG).$(MACH)
  24 
  25 $(BUILD64) OBJS64 = $(OBJS:%.o=%.$(MACH64).o)
  26 $(BUILD64) PROG64= $(PROG).$(MACH64)
  27 
  28 $(OBJS_OVERRIDE)SRCS = $(PROG).c ../common/test_common.c
  29 
  30 C99MODE = -xc99=%all
  31 LINTFLAGS += -I../common -DARCH=\"ARCH\" -DLINT
  32 CPPFLAGS += -I../common
  33 
  34 ROOTOPTPKG = $(ROOT)/opt/libc-tests
  35 TESTDIR = $(ROOTOPTPKG)/tests
  36 
  37 CMDS = $(PROG32:%=$(TESTDIR)/%) $(PROG64:%=$(TESTDIR)/%) \
  38         $(KSHPROG:%=$(TESTDIR)/%) $(ARCHPROG:%=$(TESTDIR)/%)
  39 $(CMDS) := FILEMODE = 0555
  40 
  41 all: $(PROG32) $(PROG64) $(KSHPROG) $(ARCHPROG) $(SUBDIRS)
  42 
  43 $(PROG32): $(OBJS32)
  44         $(LINK.c) $(OBJS32) -o $@ $(LDLIBS)
  45         $(POST_PROCESS)
  46 
  47 $(PROG64): $(OBJS64)
  48         $(LINK64.c) $(OBJS64) -o $@ $(LDLIBS64)
  49         $(POST_PROCESS)
  50 
  51 $(KSHPROG): $(KSHPROG).ksh
  52         $(RM) $@
  53         $(CP) $(KSHPROG).ksh $(@)
  54         $(CHMOD) +x $@
  55 
  56 $(ARCHPROG): ../common/run_arch_tests.ksh
  57         $(RM) $@
  58         $(CP) ../common/run_arch_tests.ksh $(@)
  59         $(CHMOD) +x $@
  60 
  61 %.$(MACH).o: %.c
  62         $(COMPILE.c) -o $@ $(CFLAGS_$(MACH)) -DARCH=\"$(MACH)\" $<
  63 
  64 %.$(MACH).o: ../common/%.c
  65         $(COMPILE.c) -o $@ $(CFLAGS_$(MACH)) -DARCH=\"$(MACH)\" $<
  66 
  67 %.$(MACH64).o: %.c
  68         $(COMPILE64.c) -o $@ $(CFLAGS_$(MACH64)) -DARCH=\"$(MACH64)\" $<
  69 
  70 %.$(MACH64).o: ../common/%.c
  71         $(COMPILE64.c) -o $@ $(CFLAGS_$(MACH64)) -DARCH=\"$(MACH64)\" $<
  72 
  73 install: $(SUBDIRS) $(CMDS)
  74 
  75 lint: lint_SRCS
  76 
  77 clobber: clean
  78         -$(RM) $(PROG32) $(PROG64) $(KSHPROG) $(ARCHPROG)
  79 
  80 clean:
  81         -$(RM) $(OBJS32) $(OBJS64)
  82 
  83 $(CMDS): $(TESTDIR) $(PROG32) $(PROG64) $(KSHPROG) $(ARCHPROG)
  84 
  85 $(TESTDIR):
  86         $(INS.dir)
  87 
  88 $(TESTDIR)/%: %
  89         $(INS.file)