xref: /illumos-gate/usr/src/test/util-tests/tests/libdhcputil/Makefile (revision 438283cf397cce47d80cc67b04bbfdfe73b0d142)
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
16include $(SRC)/Makefile.master
17
18ROOTOPTPKG = $(ROOT)/opt/util-tests
19TESTDIR = $(ROOTOPTPKG)/tests
20
21SRCS = libdhcputil.c
22PROG = libdhcputil
23
24PROG32 = $(PROG:%=%.32)
25PROG64 = $(PROG:%=%.64)
26
27OBJS32 = $(SRCS:%.c=%.32.o)
28OBJS64 = $(SRCS:%.c=%.64.o)
29
30include $(SRC)/cmd/Makefile.cmd
31include $(SRC)/cmd/Makefile.ctf
32include $(SRC)/test/Makefile.com
33
34CMDS = $(PROG32:%=$(TESTDIR)/%) $(PROG64:%=$(TESTDIR)/%)
35$(CMDS) := FILEMODE = 0555
36
37CSTD = $(CSTD_GNU17)
38CTF_MODE = link
39
40LDLIBS += -ldhcputil
41LDLIBS64 += -ldhcputil
42CFLAGS += -_gcc=-Wall -_gcc=-Wextra
43CFLAGS64 += -_gcc=-Wall -_gcc=-Wextra
44
45all: $(PROG32) $(PROG64)
46
47install: all $(CMDS)
48
49clobber: clean
50	-$(RM) $(PROG32) $(PROG64)
51
52clean:
53	-$(RM) $(OBJS32) $(OBJS64)
54
55%.32.o: %.c
56	$(COMPILE.c) -o $@ -c $<
57	$(POST_PROCESS_O)
58
59%.64.o: %.c
60	$(COMPILE64.c) -o $@ -c $<
61	$(POST_PROCESS_O)
62
63$(PROG32): $(OBJS32)
64	$(LINK.c) $(OBJS32) -o $@ $(LDLIBS)
65	$(POST_PROCESS)
66
67$(PROG64): $(OBJS64)
68	$(LINK64.c) $(OBJS64) -o $@ $(LDLIBS64)
69	$(POST_PROCESS)
70
71$(CMDS): $(TESTDIR) $(PROG32) $(PROG64)
72
73$(TESTDIR):
74	$(INS.dir)
75
76$(TESTDIR)/%: %
77	$(INS.file)
78