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