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		timer \
33		uccid \
34		$(SUBDIRS_$(MACH))
35
36PROGS = \
37	odirectory \
38	writev
39
40CPPFLAGS += -D_REENTRANT
41PROGS32 = $(PROGS:%=%.32)
42PROGS64 = $(PROGS:%=%.64)
43
44ROOTOPTDIR = $(ROOT)/opt/os-tests/tests
45ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTDIR)/%) \
46	$(PROGS64:%=$(ROOTOPTDIR)/%) \
47	$(SCRIPTS:%=$(ROOTOPTDIR)/%)
48
49odirectory.32 :=	LDLIBS += -lsocket
50odirectory.64 :=	LDLIBS64 += -lsocket
51
52writev.32 :=		CPPFLAGS += -D_FILE_OFFSET_BITS=64
53writev.32 :=		CSTD = $(CSTD_GNU99)
54writev.64 :=		CSTD = $(CSTD_GNU99)
55
56include $(SRC)/cmd/Makefile.cmd
57
58all     :=      TARGET = all
59install :=      TARGET = install
60clean   :=      TARGET = clean
61clobber :=      TARGET = clobber
62
63.KEEP_STATE:
64
65install: $(SUBDIRS) $(ROOTOPTPROGS)
66
67all: $(SUBDIRS) $(PROGS32) $(PROGS64)
68
69clean: $(SUBDIRS)
70
71$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTDIR)
72
73$(ROOTOPTDIR):
74	$(INS.dir)
75
76$(ROOTOPTDIR)/%: %
77	$(INS.file)
78
79$(ROOTOPTDIR)/%: %.ksh
80	$(INS.rename)
81
82%.64: %.c
83	$(LINK64.c) -o $@ $< $(LDLIBS64)
84	$(POST_PROCESS)
85
86%.32: %.c
87	$(LINK.c) -o $@ $< $(LDLIBS)
88	$(POST_PROCESS)
89
90clobber: $(SUBDIRS)
91	$(RM) $(PROGS32) $(PROGS64)
92
93$(SUBDIRS): FRC
94	@cd $@; pwd; $(MAKE) $(TARGET)
95
96FRC:
97