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