]>
Commit | Line | Data |
---|---|---|
1 | ifeq ($(PLATFORM),iphoneos) | |
2 | # iOS internal SDK | |
3 | ARCHS=arm64 | |
4 | endif | |
5 | ||
6 | ifeq ($(PLATFORM),) | |
7 | PLATFORM=macosx | |
8 | endif | |
9 | ||
10 | ifeq ($(PLATFORM),macosx) | |
11 | # Mac OS X internal SDK | |
12 | ARCHS=x86_64 | |
13 | endif | |
14 | ||
15 | # Mac OS X or iOS internal SDK | |
16 | SDK=$(PLATFORM).internal | |
17 | SYSROOT=$(shell xcodebuild -version -sdk $(SDK) Path) | |
18 | CC = xcrun -sdk $(SDK) clang | |
19 | PF_INC = -F$(SYSROOT)/System/Library/PrivateFrameworks | |
20 | ||
21 | ARCH_FLAGS=$(foreach a,$(ARCHS),-arch $(a)) | |
22 | ||
23 | EXTRA_CFLAGS=-fsanitize=address | |
24 | #EXTRA_CFLAGS= | |
25 | ||
26 | TEST_INCLUDE=-I. -I../common -I../../dnsinfo -I../../nwi -I../../libSystemConfiguration -I../../SystemConfiguration.fproj -I../../IPMonitorControl -I../../IPMonitorControl/AWD -I$(SYSROOT)/System/Library/Frameworks/System.framework/PrivateHeaders | |
27 | ||
28 | REFERENCE_OUTPUT=../../common/reference_output.sh | |
29 | ||
30 | all: test_ipv4_routelist test_ipv6_routelist | |
31 | ||
32 | # ---------- | |
33 | ||
34 | agent-monitor.o: agent-monitor.m | |
35 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -Wall -O0 -g -c agent-monitor.m | |
36 | ||
37 | configAgent.o: configAgent.m | |
38 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -Wall -O0 -g -c configAgent.m | |
39 | ||
40 | controller.o: controller.m | |
41 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -Wall -O0 -g -c controller.m | |
42 | ||
43 | dnsAgent.o: dnsAgent.m | |
44 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -Wall -O0 -g -c dnsAgent.m | |
45 | ||
46 | proxyAgent.o: proxyAgent.m | |
47 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -Wall -O0 -g -c proxyAgent.m | |
48 | ||
49 | dnsinfo_create.o: ../../dnsinfo/dnsinfo_create.h ../../dnsinfo/dnsinfo_create.c | |
50 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -Wall -O0 -g -c ../../dnsinfo/dnsinfo_create.c | |
51 | ||
52 | dnsinfo_flatfile.o: ../../dnsinfo/dnsinfo_copy.c ../../dnsinfo/dnsinfo_flatfile.c | |
53 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -D_PATH_RESOLVER_DIR='"/var/tmp/resolver"' -Wall -O0 -g -c ../../dnsinfo/dnsinfo_flatfile.c | |
54 | ||
55 | dnsinfo_server.o: ../../dnsinfo/dnsinfo_copy.c ../../dnsinfo/dnsinfo_server.c | |
56 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -Wall -O0 -g -c ../../dnsinfo/dnsinfo_server.c | |
57 | ||
58 | dns-configuration.o: dns-configuration.h dns-configuration.c dnsinfo_create.o | |
59 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} ${EXTRA_CFLAGS} -Wall -O0 -g -c dns-configuration.c | |
60 | ||
61 | nat64-configuration.o: nat64-configuration.h nat64-configuration.c | |
62 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} ${EXTRA_CFLAGS} -Wall -O0 -g -c nat64-configuration.c | |
63 | ||
64 | network_state_information_priv.o: ../../nwi/network_state_information_priv.h ../../nwi/network_state_information_priv.c | |
65 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -Wall -O0 -g -c ../../nwi/network_state_information_priv.c | |
66 | ||
67 | network_information_server.o: ../../nwi/network_information_server.h ../../nwi/network_information_server.c | |
68 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -Wall -O0 -g -c ../../nwi/network_information_server.c | |
69 | ||
70 | proxy-configuration.o: proxy-configuration.h proxy-configuration.c | |
71 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -Wall -O0 -g -c proxy-configuration.c | |
72 | ||
73 | set-hostname.o: set-hostname.c | |
74 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} ${EXTRA_CFLAGS} -Wall -O0 -g -c set-hostname.c | |
75 | ||
76 | smb-configuration.o: smb-configuration.c | |
77 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} ${EXTRA_CFLAGS} -Wall -O0 -g -c smb-configuration.c | |
78 | ||
79 | libSystemConfiguration_client.o: ../../libSystemConfiguration/libSystemConfiguration_client.h ../../libSystemConfiguration/libSystemConfiguration_client.c | |
80 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -Wall -O0 -g -c ../../libSystemConfiguration/libSystemConfiguration_client.c | |
81 | ||
82 | libSystemConfiguration_server.o: ../../libSystemConfiguration/libSystemConfiguration_server.h ../../libSystemConfiguration/libSystemConfiguration_server.c | |
83 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -Wall -O0 -g -c ../../libSystemConfiguration/libSystemConfiguration_server.c | |
84 | ||
85 | IPMonitorControlPrefs.o: ../common/IPMonitorControlPrefs.h ../common/IPMonitorControlPrefs.c | |
86 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -Wall -O0 -g -c ../common/IPMonitorControlPrefs.c | |
87 | ||
88 | IPMonitorControlServer.o: ../../IPMonitorControl/IPMonitorControlServer.c | |
89 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) ${TEST_INCLUDE} -Wall -O0 -g -c $^ | |
90 | ||
91 | # ---------- | |
92 | ||
93 | ip_pluginX.o: Makefile ip_plugin.c | |
94 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -DTEST_DNS ${TEST_INCLUDE} ${EXTRA_CFLAGS} -Wall -O0 -g -c -o ip_pluginX.o ip_plugin.c | |
95 | ||
96 | # ---------- | |
97 | ||
98 | dns-configurationX.o: Makefile dns-configuration.h dns-configuration.c dnsinfo_create.o | |
99 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -DMAIN ${TEST_INCLUDE} ${EXTRA_CFLAGS} -Wall -O0 -g -c -o dns-configurationX.o dns-configuration.c | |
100 | ||
101 | test_dns: ip_pluginX.o IPMonitorControlPrefs.o agent-monitor.o configAgent.o controller.o dnsAgent.o proxyAgent.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_server.o dns-configurationX.o nat64-configuration.o proxy-configuration.o set-hostname.o smb-configuration.o libSystemConfiguration_client.o libSystemConfiguration_server.o | |
102 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -Wall -O0 -g -o test_dns ip_pluginX.o IPMonitorControlPrefs.o agent-monitor.o configAgent.o controller.o dnsAgent.o proxyAgent.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_server.o dns-configurationX.o nat64-configuration.o proxy-configuration.o set-hostname.o smb-configuration.o libSystemConfiguration_client.o libSystemConfiguration_server.o ${EXTRA_CFLAGS} -lnetwork -framework SystemConfiguration -framework CoreFoundation -framework CoreServices -framework Foundation -framework Network -framework NetworkExtension | |
103 | ||
104 | # ---------- | |
105 | ||
106 | proxy-configurationX.o: Makefile proxy-configuration.h proxy-configuration.c | |
107 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -DMAIN ${TEST_INCLUDE} ${EXTRA_CFLAGS} -Wall -O0 -g -c -o proxy-configurationX.o proxy-configuration.c | |
108 | ||
109 | test_proxy: ip_pluginX.o IPMonitorControlPrefs.o agent-monitor.o configAgent.o controller.o dnsAgent.o proxyAgent.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_server.o dns-configuration.o nat64-configuration.o proxy-configurationX.o set-hostname.o smb-configuration.o libSystemConfiguration_client.o libSystemConfiguration_server.o | |
110 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -Wall -O0 -g -o test_proxy ip_pluginX.o IPMonitorControlPrefs.o agent-monitor.o configAgent.o controller.o dnsAgent.o proxyAgent.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_server.o dns-configuration.o nat64-configuration.o proxy-configurationX.o set-hostname.o smb-configuration.o libSystemConfiguration_client.o libSystemConfiguration_server.o ${EXTRA_CFLAGS} -lnetwork -framework SystemConfiguration -framework CoreFoundation -framework CoreServices -framework Foundation -framework Network -framework NetworkExtension | |
111 | ||
112 | # ---------- | |
113 | ||
114 | set-hostnameX.o: Makefile set-hostname.h set-hostname.c | |
115 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -DMAIN -DDEBUG ${TEST_INCLUDE} ${EXTRA_CFLAGS} -Wall -O0 -g -c -o set-hostnameX.o set-hostname.c | |
116 | ||
117 | test_hostname: ip_pluginX.o IPMonitorControlPrefs.o agent-monitor.o configAgent.o controller.o dnsAgent.o proxyAgent.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_server.o dns-configuration.o nat64-configuration.o proxy-configuration.o set-hostnameX.o smb-configuration.o libSystemConfiguration_client.o libSystemConfiguration_server.o | |
118 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -Wall -O0 -g -o test_hostname ip_pluginX.o IPMonitorControlPrefs.o agent-monitor.o configAgent.o controller.o dnsAgent.o proxyAgent.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_server.o dns-configuration.o nat64-configuration.o proxy-configuration.o set-hostnameX.o smb-configuration.o libSystemConfiguration_client.o libSystemConfiguration_server.o ${EXTRA_CFLAGS} -lnetwork -framework SystemConfiguration -framework CoreFoundation -framework CoreServices -framework Foundation -framework Network -framework NetworkExtension | |
119 | ||
120 | # ---------- | |
121 | ||
122 | smb-configurationX.o: smb-configuration.h smb-configuration.c | |
123 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -DMAIN -DDEBUG ${TEST_INCLUDE} ${EXTRA_CFLAGS} -Wall -O0 -g -c -o smb-configurationX.o smb-configuration.c | |
124 | ||
125 | test_smb: ip_pluginX.o IPMonitorControlPrefs.o agent-monitor.o configAgent.o controller.o dnsAgent.o proxyAgent.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_server.o dns-configuration.o nat64-configuration.o proxy-configuration.o set-hostname.o smb-configurationX.o libSystemConfiguration_client.o libSystemConfiguration_server.o | |
126 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -Wall -O0 -g -o test_smb ip_pluginX.o IPMonitorControlPrefs.o agent-monitor.o configAgent.o controller.o dnsAgent.o proxyAgent.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_server.o dns-configuration.o nat64-configuration.o proxy-configuration.o set-hostname.o smb-configurationX.o libSystemConfiguration_client.o libSystemConfiguration_server.o ${EXTRA_CFLAGS} -lnetwork -framework SystemConfiguration -framework CoreFoundation -framework CoreServices -framework Foundation -framework Network -framework NetworkExtension | |
127 | ||
128 | # ---------- | |
129 | ||
130 | test_dns_order.o: ip_plugin.c | |
131 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -DTEST_DNS_ORDER ${TEST_INCLUDE} ${EXTRA_CFLAGS} -Wall -O0 -g -c -o $@ $^ | |
132 | ||
133 | test_dns_order: test_dns_order.o IPMonitorControlPrefs.o agent-monitor.o configAgent.o controller.o dnsAgent.o proxyAgent.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_server.o dns-configuration.o proxy-configuration.o set-hostname.o smb-configuration.o libSystemConfiguration_client.o libSystemConfiguration_server.o nat64-configuration.o | |
134 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -Wall -O0 -g -o $@ test_dns_order.o IPMonitorControlPrefs.o agent-monitor.o configAgent.o controller.o dnsAgent.o proxyAgent.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_server.o dns-configuration.o proxy-configuration.o set-hostname.o smb-configuration.o libSystemConfiguration_client.o libSystemConfiguration_server.o nat64-configuration.o $(EXTRA_CFLAGS) -lnetwork -framework SystemConfiguration -framework CoreFoundation -framework Foundation -framework Network -framework NetworkExtension -framework CoreServices | |
135 | ||
136 | # ---------- | |
137 | ||
138 | test_ipv4_routelist.o: ip_plugin.c | |
139 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -DTEST_IPV4_ROUTELIST ${TEST_INCLUDE} ${EXTRA_CFLAGS} -Wall -O0 -g -c -o $@ $^ | |
140 | ||
141 | test_ipv4_routelist: test_ipv4_routelist.o IPMonitorControlPrefs.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_server.o dns-configuration.o proxy-configuration.o set-hostname.o smb-configuration.o libSystemConfiguration_client.o libSystemConfiguration_server.o | |
142 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -Wall -O0 -g -o test_ipv4_routelist $^ ${EXTRA_CFLAGS} -lnetwork -framework SystemConfiguration -framework CoreFoundation -framework Foundation -framework Network -framework NetworkExtension -framework CoreServices | |
143 | ||
144 | test_ipv4_routelist_reference.txt: test_ipv4_routelist | |
145 | sh $(REFERENCE_OUTPUT) create ./test_ipv4_routelist test_ipv4_routelist_reference.txt routelist_output_filter.sh | |
146 | ||
147 | test_ipv4_routelist_test: test_ipv4_routelist | |
148 | sh $(REFERENCE_OUTPUT) test ./test_ipv4_routelist test_ipv4_routelist_reference.txt routelist_output_filter.sh | |
149 | ||
150 | test_ipv4_routelist_coverage: test_ipv4_routelist | |
151 | ./test_ipv4_routelist -1 | grep Hit | awk '{print $$2}' | sort | uniq | |
152 | ||
153 | # ---------- | |
154 | ||
155 | test_ipv6_routelist.o: ip_plugin.c | |
156 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -DTEST_IPV6_ROUTELIST=1 ${TEST_INCLUDE} ${EXTRA_CFLAGS} -Wall -O0 -g -c -o $@ $^ | |
157 | ||
158 | test_ipv6_routelist: test_ipv6_routelist.o IPMonitorControlPrefs.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_server.o dns-configuration.o proxy-configuration.o set-hostname.o smb-configuration.o libSystemConfiguration_client.o libSystemConfiguration_server.o | |
159 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -Wall -O0 -g -o test_ipv6_routelist $^ ${EXTRA_CFLAGS} -lnetwork -framework SystemConfiguration -framework CoreFoundation -framework Foundation -framework Network -framework NetworkExtension -framework CoreServices | |
160 | ||
161 | test_ipv6_routelist_reference.txt: test_ipv6_routelist | |
162 | sh $(REFERENCE_OUTPUT) create ./test_ipv6_routelist test_ipv6_routelist_reference.txt routelist_output_filter.sh | |
163 | ||
164 | test_ipv6_routelist_test: test_ipv6_routelist | |
165 | sh $(REFERENCE_OUTPUT) test ./test_ipv6_routelist test_ipv6_routelist_reference.txt routelist_output_filter.sh | |
166 | ||
167 | test_ipv6_routelist_coverage: test_ipv6_routelist | |
168 | ./test_ipv6_routelist -1 | grep Hit | awk '{print $$2}' | sort | uniq | |
169 | ||
170 | # ---------- | |
171 | ||
172 | IPMonitor.o: ip_plugin.c | |
173 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -DTEST_IPMONITOR ${TEST_INCLUDE} ${EXTRA_CFLAGS} -Wall -O0 -g -c -o IPMonitor.o ip_plugin.c | |
174 | ||
175 | IPMonitor: IPMonitor.o IPMonitorControlPrefs.o agent-monitor.o configAgent.o controller.o dnsAgent.o proxyAgent.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_server.o network_state_information_priv.o network_information_server.o dns-configuration.o proxy-configuration.o set-hostname.o smb-configuration.o IPMonitorControlServer.o libSystemConfiguration_client.o libSystemConfiguration_server.o | |
176 | $(CC) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -Wall -O0 -g -o IPMonitor IPMonitor.o IPMonitorControlPrefs.o agent-monitor.o configAgent.o controller.o dnsAgent.o proxyAgent.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_server.o network_state_information_priv.o network_information_server.o dns-configuration.o proxy-configuration.o set-hostname.o smb-configuration.o IPMonitorControlServer.o libSystemConfiguration_client.o libSystemConfiguration_server.o ${EXTRA_CFLAGS} -lnetwork -framework SystemConfiguration -framework CoreFoundation -framework Foundation -framework Network -framework NetworkExtension | |
177 | ||
178 | # ---------- | |
179 | ||
180 | nat64: nat64-configuration.c | |
181 | $(CC) -DTEST_NAT64_CONFIGURATION $(TEST_INCLUDE) $(PF_INC) $(ARCH_FLAGS) -isysroot $(SYSROOT) -lnetwork -framework CoreFoundation -framework SystemConfiguration -Wall -O0 -g -o $@ $^ | |
182 | ||
183 | # ---------- | |
184 | ||
185 | clean: | |
186 | rm -rf *.dSYM *.o test_dns test_hostname test_proxy test_smb test_ipv4_routelist test_ipv6_routelist test_dns_order IPMonitor nat64 |