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 OBJS32 = $(PROG:%=%.$(MACH).o)
  22 PROG32 = $(PROG).$(MACH)
  23 
  24 $(BUILD64) OBJS64 = $(PROG:%=%.$(MACH64).o)
  25 $(BUILD64) PROG64= $(PROG).$(MACH64)
  26 
  27 SRCS = $(PROG).c
  28 
  29 C99MODE = -xc99=%all
  30 CFLAGS_amd64 = -m64
  31 CFLAGS_i386 = -m32
  32 CFLAGS_sparc = -m32
  33 CFLAGS_sparcv9 = -m64
  34 LINTFLAGS += -DARCH=\"ARCH\"
  35 
  36 ROOTOPTPKG = $(ROOT)/opt/libc-tests
  37 TESTDIR = $(ROOTOPTPKG)/tests
  38 
  39 CMDS = $(PROG32:%=$(TESTDIR)/%) $(PROG64:%=$(TESTDIR)/%) \
  40         $(KSHPROG:%=$(TESTDIR)/%) $(ARCHPROG:%=$(TESTDIR)/%)
  41 $(CMDS) := FILEMODE = 0555
  42 
  43 all: $(PROG32) $(PROG64) $(KSHPROG) $(ARCHPROG) $(SUBDIRS)
  44 
  45 $(PROG32): $(OBJS32)
  46         $(LINK.c) $(CFLAGS_$(MACH)) $(OBJS32) -o $@ $(LDLIBS)
  47         $(POST_PROCESS)
  48 
  49 $(PROG64): $(OBJS64)
  50         $(LINK.c) $(CFLAGS_$(MACH64)) $(OBJS64) -o $@ $(LDLIBS)
  51         $(POST_PROCESS)
  52 
  53 $(KSHPROG): $(KSHPROG).ksh
  54         $(RM) $@
  55         $(CP) $(KSHPROG).ksh $(@)
  56         $(CHMOD) +x $@
  57 
  58 $(ARCHPROG): ../common/run_arch_tests.ksh
  59         $(RM) $@
  60         $(CP) ../common/run_arch_tests.ksh $(@)
  61         $(CHMOD) +x $@
  62 
  63 %.$(MACH).o: %.c
  64         $(COMPILE.c) -o $@ $(CFLAGS_$(MACH)) -DARCH=\"$(MACH)\" $<
  65 
  66 %.$(MACH64).o: %.c
  67         $(COMPILE.c) -o $@ $(CFLAGS_$(MACH64)) -DARCH=\"$(MACH64)\" $<
  68 
  69 install: $(SUBDIRS) $(CMDS)
  70 
  71 lint: lint_SRCS
  72 
  73 clobber: clean
  74         -$(RM) $(PROG32) $(PROG64) $(KSHPROG) $(ARCHPROG)
  75 
  76 clean:
  77         -$(RM) $(OBJS32) $(OBJS64)
  78 
  79 $(CMDS): $(TESTDIR) $(PROG32) $(PROG64) $(KSHPROG) $(ARCHPROG)
  80 
  81 $(TESTDIR):
  82         $(INS.dir)
  83 
  84 $(TESTDIR)/%: %
  85         $(INS.file)