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