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#
16
17SUBDIRS_i386 = i386 imc
18
19SUBDIRS =       \
20		ddi_ufm \
21		file-locking \
22		ksensor \
23		libtopo \
24		pf_key \
25		poll \
26		sdevfs \
27		secflags \
28		sigqueue \
29		sockfs \
30		spoof-ras \
31		stress \
32		syscall \
33		timer \
34		uccid \
35		$(SUBDIRS_$(MACH))
36
37PROGS = \
38	odirectory \
39	writev
40
41CPPFLAGS += -D_REENTRANT
42PROGS32 = $(PROGS:%=%.32)
43PROGS64 = $(PROGS:%=%.64)
44
45ROOTOPTDIR = $(ROOT)/opt/os-tests/tests
46ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTDIR)/%) \
47	$(PROGS64:%=$(ROOTOPTDIR)/%) \
48	$(SCRIPTS:%=$(ROOTOPTDIR)/%)
49
50odirectory.32 :=	LDLIBS += -lsocket
51odirectory.64 :=	LDLIBS64 += -lsocket
52
53writev.32 :=		CPPFLAGS += -D_FILE_OFFSET_BITS=64
54writev.32 :=		CSTD = $(CSTD_GNU99)
55writev.64 :=		CSTD = $(CSTD_GNU99)
56
57include $(SRC)/cmd/Makefile.cmd
58
59all     :=      TARGET = all
60install :=      TARGET = install
61clean   :=      TARGET = clean
62clobber :=      TARGET = clobber
63
64.KEEP_STATE:
65
66install: $(SUBDIRS) $(ROOTOPTPROGS)
67
68all: $(SUBDIRS) $(PROGS32) $(PROGS64)
69
70clean: $(SUBDIRS)
71
72$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTDIR)
73
74$(ROOTOPTDIR):
75	$(INS.dir)
76
77$(ROOTOPTDIR)/%: %
78	$(INS.file)
79
80$(ROOTOPTDIR)/%: %.ksh
81	$(INS.rename)
82
83%.64: %.c
84	$(LINK64.c) -o $@ $< $(LDLIBS64)
85	$(POST_PROCESS)
86
87%.32: %.c
88	$(LINK.c) -o $@ $< $(LDLIBS)
89	$(POST_PROCESS)
90
91clobber: $(SUBDIRS)
92	$(RM) $(PROGS32) $(PROGS64)
93
94$(SUBDIRS): FRC
95	@cd $@; pwd; $(MAKE) $(TARGET)
96
97FRC:
98