xref: /illumos-gate/usr/src/test/os-tests/tests/libsocket/Makefile (revision ff260c5b4bfdf290e38c0323160d5ec9d778a001)
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
16#
17# Makefile for various libsocket tests.
18#
19
20PROGS = \
21	getifaddrs_dl \
22	inet6_opt \
23	nametoindex
24
25PROGS32 += $(PROGS:%=%.32)
26PROGS64 += $(PROGS:%=%.64)
27
28ROOTOPTDIR = $(ROOT)/opt/os-tests/tests
29ROOTOPTSOCK = $(ROOTOPTDIR)/libsocket
30ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTSOCK)/%) $(PROGS64:%=$(ROOTOPTSOCK)/%)
31
32include $(SRC)/cmd/Makefile.cmd
33include $(SRC)/cmd/Makefile.ctf
34
35CPPFLAGS += -D_REENTRANT
36CSTD = $(CSTD_GNU17)
37CTF_MODE = link
38LDLIBS += -lsocket
39LDLIBS64 += -lsocket
40
41getifaddrs_dl.32 := LDLIBS += -ldladm -ldlpi
42getifaddrs_dl.64 := LDLIBS64 += -ldladm -ldlpi
43
44.KEEP_STATE:
45
46all: $(PROGS32) $(PROGS64)
47
48clobber: clean
49	-$(RM) $(PROGS32) $(PROGS64)
50
51clean:
52	-$(RM) *.o.32 *.o.64
53
54install: $(ROOTOPTSOCK) .WAIT $(ROOTOPTPROGS)
55
56$(ROOTOPTSOCK): $(ROOTOPTTESTS)
57	$(INS.dir)
58
59$(ROOTOPTSOCK)/%: %
60	$(INS.file)
61
62%.o.32: %.c
63	$(COMPILE.c) -o $@ -c $<
64	$(POST_PROCESS_O)
65
66%.o.64: %.c
67	$(COMPILE64.c) -o $@ -c $<
68	$(POST_PROCESS_O)
69
70%.64: %.o.64
71	$(LINK64.c) -o $@ $< $(LDLIBS64)
72	$(POST_PROCESS)
73
74%.32: %.o.32
75	$(LINK.c) -o $@ $< $(LDLIBS)
76	$(POST_PROCESS)
77