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