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