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 2022 Oxide Computer Company
14# Copyright 2023 MNX Cloud, Inc.
15#
16
17include $(SRC)/cmd/Makefile.cmd
18include $(SRC)/test/Makefile.com
19
20PROGS = basic_args basic_read multipoll
21COMMON_OBJS = common.o
22
23poll_test := LDLIBS += -lsocket
24poll_test.ln := LDLIBS += -lsocket
25CSTD = $(CSTD_GNU99)
26
27ROOTOPTDIR = $(ROOT)/opt/os-tests/tests
28ROOTOPTSIGFD = $(ROOTOPTDIR)/signalfd
29
30CMDS = $(PROGS:%=$(ROOTOPTSIGFD)/%)
31$(CMDS) := FILEMODE = 0555
32
33all: $(PROGS)
34
35install: all $(CMDS)
36
37clobber: clean
38	-$(RM) $(PROGS)
39
40clean:
41	-$(RM) $(COMMON_OBJS)
42
43$(CMDS): $(ROOTOPTSIGFD) $(PROGS)
44
45$(PROGS): $(COMMON_OBJS)
46
47$(ROOTOPTSIGFD):
48	$(INS.dir)
49
50$(ROOTOPTSIGFD)/%: %
51	$(INS.file)
52
53%.o: %.c
54	$(COMPILE.c) -o $@ -c $<
55	$(POST_PROCESS_O)
56
57%: %.o
58	$(LINK.c) -o $@ $< $(COMMON_OBJS) $(LDLIBS)
59	$(POST_PROCESS)
60