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