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, 2016 by Delphix. All rights reserved.
  14 # Copyright 2020 Joyent, Inc.
  15 # Copyright 2021 Tintri by DDN, Inc. All rights reserved.
  16 # Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
  17 # Copyright 2023 Oxide Computer Company
  18 #
  19 
  20 SUBDIRS_i386 = i386 imc zen_umc xsave
  21 
  22 SUBDIRS =       \
  23                 cores \
  24                 ddi_ufm \
  25                 definit \
  26                 file-locking \
  27                 ksensor \
  28                 libtopo \
  29                 pf_key \
  30                 poll \
  31                 portfs \
  32                 regression \
  33                 sdevfs \
  34                 secflags \
  35                 signalfd \
  36                 sigqueue \
  37                 sockfs \
  38                 spoof-ras \
  39                 stackalign \
  40                 stress \
  41                 syscall \
  42                 timer \
  43                 uccid \
  44                 $(SUBDIRS_$(MACH))
  45 
  46 PROGS = \
  47         clock_gettime \
  48         eventfd \
  49         odirectory \
  50         ucontext \
  51         getcontext_extd \
  52         writev
  53 
  54 CPPFLAGS += -D_REENTRANT
  55 PROGS32 = $(PROGS:%=%.32)
  56 PROGS64 = $(PROGS:%=%.64)
  57 
  58 ROOTOPTDIR = $(ROOT)/opt/os-tests/tests
  59 ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTDIR)/%) \
  60         $(PROGS64:%=$(ROOTOPTDIR)/%) \
  61         $(SCRIPTS:%=$(ROOTOPTDIR)/%)
  62 
  63 odirectory.32 :=        LDLIBS += -lsocket
  64 odirectory.64 :=        LDLIBS64 += -lsocket
  65 
  66 clock_gettime.32 :=     LDLIBS += -lproc
  67 clock_gettime.32 :=     CSTD = $(CSTD_GNU99)
  68 clock_gettime.64 :=     LDLIBS64 += -lproc
  69 clock_gettime.64 :=     CSTD = $(CSTD_GNU99)
  70 
  71 ucontext.32 :=          SMOFF += unreachable
  72 ucontext.64 :=          SMOFF += unreachable
  73 
  74 writev.32 :=            CPPFLAGS += -D_FILE_OFFSET_BITS=64
  75 writev.32 :=            CSTD = $(CSTD_GNU99)
  76 writev.64 :=            CSTD = $(CSTD_GNU99)
  77 
  78 include $(SRC)/cmd/Makefile.cmd
  79 
  80 all     :=      TARGET = all
  81 install :=      TARGET = install
  82 clean   :=      TARGET = clean
  83 clobber :=      TARGET = clobber
  84 
  85 .KEEP_STATE:
  86 
  87 install: $(SUBDIRS) $(ROOTOPTPROGS)
  88 
  89 all: $(SUBDIRS) $(PROGS32) $(PROGS64)
  90 
  91 clean: $(SUBDIRS)
  92 
  93 $(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTDIR)
  94 
  95 $(ROOTOPTDIR):
  96         $(INS.dir)
  97 
  98 $(ROOTOPTDIR)/%: %
  99         $(INS.file)
 100 
 101 $(ROOTOPTDIR)/%: %.ksh
 102         $(INS.rename)
 103 
 104 %.64: %.c
 105         $(LINK64.c) -o $@ $< $(LDLIBS64)
 106         $(POST_PROCESS)
 107 
 108 %.32: %.c
 109         $(LINK.c) -o $@ $< $(LDLIBS)
 110         $(POST_PROCESS)
 111 
 112 clobber: $(SUBDIRS)
 113         $(RM) $(PROGS32) $(PROGS64)
 114 
 115 $(SUBDIRS): FRC
 116         @cd $@; pwd; $(MAKE) $(TARGET)
 117 
 118 FRC: