xref: /illumos-gate/usr/src/test/libc-tests/tests/posix_spawn/Makefile (revision 93d6c51de00648a982a50fbecc433b5482953fc7)
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 2026 Oxide Computer Company
14#
15
16PROGS = posix_spawn_chdir posix_spawn_fileactions posix_spawn_attr \
17	posix_spawn_path posix_spawn_pipe_np posix_spawn_priv
18
19HELPERS32 = posix_spawn_child.32
20HELPERS64 = posix_spawn_child.64
21
22DATA = posix_spawn_noshebang
23
24COMMON_OBJS32 = posix_spawn_common.32.o
25COMMON_OBJS64 = posix_spawn_common.64.o
26
27PROGS32 = $(PROGS:%=%.32) $(HELPERS32)
28PROGS64 = $(PROGS:%=%.64) $(HELPERS64)
29OBJS32 = $(PROGS32:%=%.o) $(COMMON_OBJS32)
30OBJS64 = $(PROGS64:%=%.o) $(COMMON_OBJS64)
31
32ROOTOPTDIR = $(ROOT)/opt/libc-tests/tests
33ROOTOPTSPAWN = $(ROOTOPTDIR)/posix_spawn
34ROOTOPTPROGS =	$(PROGS32:%=$(ROOTOPTSPAWN)/%) \
35		$(PROGS64:%=$(ROOTOPTSPAWN)/%)
36ROOTOPTDATA = $(DATA:%=$(ROOTOPTSPAWN)/%)
37
38include $(SRC)/cmd/Makefile.cmd
39include $(SRC)/cmd/Makefile.ctf
40
41CSTD = $(CSTD_GNU17)
42CPPFLAGS += -D_REENTRANT
43CTF_MODE = link
44
45.KEEP_STATE:
46
47all: $(PROGS32) $(PROGS64)
48
49$(ROOTOPTSPAWN)/posix_spawn_noshebang := FILEMODE = 0555
50
51install: $(ROOTOPTPROGS) $(ROOTOPTDATA)
52
53$(ROOTOPTDIR):
54	$(INS.dir)
55
56$(ROOTOPTSPAWN): $(ROOTOPTDIR)
57	$(INS.dir)
58
59$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTSPAWN)
60$(ROOTOPTDATA): $(ROOTOPTSPAWN)
61
62$(ROOTOPTSPAWN)/%: %
63	$(INS.file)
64
65%.32.o: %.c
66	$(COMPILE.c) -o $@ $<
67	$(POST_PROCESS_O)
68
69%.32: %.32.o $(COMMON_OBJS32)
70	$(LINK.c) -o $@ $< $(COMMON_OBJS32) $(LDLIBS)
71	$(POST_PROCESS)
72
73%.64.o: %.c
74	$(COMPILE64.c) -o $@ $<
75	$(POST_PROCESS_O)
76
77%.64: %.64.o $(COMMON_OBJS64)
78	$(LINK64.c) -o $@ $< $(COMMON_OBJS64) $(LDLIBS64)
79	$(POST_PROCESS)
80
81clean:
82	$(RM) $(OBJS32) $(OBJS64)
83
84clobber: clean
85	$(RM) $(PROGS32) $(PROGS64)
86