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 2023 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		signalfd \
36		sigqueue \
37		sockfs \
38		spoof-ras \
39		stackalign \
40		stress \
41		syscall \
42		timer \
43		uccid \
44		$(SUBDIRS_$(MACH))
45
46PROGS = \
47	clock_gettime \
48	eventfd \
49	odirectory \
50	ucontext \
51	writev
52
53CPPFLAGS += -D_REENTRANT
54PROGS32 = $(PROGS:%=%.32)
55PROGS64 = $(PROGS:%=%.64)
56
57ROOTOPTDIR = $(ROOT)/opt/os-tests/tests
58ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTDIR)/%) \
59	$(PROGS64:%=$(ROOTOPTDIR)/%) \
60	$(SCRIPTS:%=$(ROOTOPTDIR)/%)
61
62odirectory.32 :=	LDLIBS += -lsocket
63odirectory.64 :=	LDLIBS64 += -lsocket
64
65clock_gettime.32 :=	LDLIBS += -lproc
66clock_gettime.32 :=	CSTD = $(CSTD_GNU99)
67clock_gettime.64 :=	LDLIBS64 += -lproc
68clock_gettime.64 :=	CSTD = $(CSTD_GNU99)
69
70ucontext.32 :=		SMOFF += unreachable
71ucontext.64 :=		SMOFF += unreachable
72
73writev.32 :=		CPPFLAGS += -D_FILE_OFFSET_BITS=64
74writev.32 :=		CSTD = $(CSTD_GNU99)
75writev.64 :=		CSTD = $(CSTD_GNU99)
76
77include $(SRC)/cmd/Makefile.cmd
78
79all     :=      TARGET = all
80install :=      TARGET = install
81clean   :=      TARGET = clean
82clobber :=      TARGET = clobber
83
84.KEEP_STATE:
85
86install: $(SUBDIRS) $(ROOTOPTPROGS)
87
88all: $(SUBDIRS) $(PROGS32) $(PROGS64)
89
90clean: $(SUBDIRS)
91
92$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTDIR)
93
94$(ROOTOPTDIR):
95	$(INS.dir)
96
97$(ROOTOPTDIR)/%: %
98	$(INS.file)
99
100$(ROOTOPTDIR)/%: %.ksh
101	$(INS.rename)
102
103%.64: %.c
104	$(LINK64.c) -o $@ $< $(LDLIBS64)
105	$(POST_PROCESS)
106
107%.32: %.c
108	$(LINK.c) -o $@ $< $(LDLIBS)
109	$(POST_PROCESS)
110
111clobber: $(SUBDIRS)
112	$(RM) $(PROGS32) $(PROGS64)
113
114$(SUBDIRS): FRC
115	@cd $@; pwd; $(MAKE) $(TARGET)
116
117FRC:
118