Files
mars_nwe_pcab/Makefile

126 lines
6.3 KiB
Makefile

CC ?= cc
CFLAGS ?= -O2 -g -Wall -Wextra
CPPFLAGS += -D_DEFAULT_SOURCE
.PHONY: all check clean
all: build/mars-pcapd build/libmarspcap.a
build:
mkdir -p $@
build/mars-pcapd: src/broker.c src/wire.c src/pcap_dyn.c src/ipxpkt.c src/gateway.c src/dhcp.c src/gateway_config.c src/gateway.h src/ipxpkt.h src/wire.h src/pcap_dyn.h | build
$(CC) $(CPPFLAGS) $(CFLAGS) -std=c11 src/broker.c src/wire.c src/pcap_dyn.c src/ipxpkt.c src/gateway.c src/dhcp.c src/gateway_config.c $(shell pkg-config --cflags --libs json-c) -ldl -o $@
build/shim.o: src/shim.c src/shim.h src/wire.h | build
$(CC) $(CPPFLAGS) $(CFLAGS) -std=c11 -c $< -o $@
build/libmarspcap.a: build/shim.o
$(AR) rcs $@ $<
build/test-wire: tests/test_wire.c src/wire.c src/wire.h | build
$(CC) $(CPPFLAGS) $(CFLAGS) -std=c11 -Isrc tests/test_wire.c src/wire.c -o $@
build/test-ipc: tests/test_ipc.c build/libmarspcap.a | build
$(CC) $(CPPFLAGS) $(CFLAGS) -std=c11 -Isrc tests/test_ipc.c build/libmarspcap.a -o $@
check: all build/test-wire build/test-ipc
./build/test-wire
clean:
rm -rf build
# Native service. CivetWeb is embedded as a library, not a stand-alone daemon.
CIVET_CFLAGS ?=
CIVET_LIBS ?= -lcivetweb
NATIVE_FLAGS = $(shell pkg-config --cflags json-c openssl)
NATIVE_LIBS = $(shell pkg-config --libs json-c openssl) -pthread
.PHONY: native check-native
native: build/mars_vme build/mars-print
build/mars_vme: native/main.c native/core.c native/supervisor.c native/admin.c native/printing.c native/gateway_auto.c src/gateway_config.c src/gateway.h native/gateway_auto.h native/core.h native/supervisor.h native/admin.h | build
$(CC) $(CFLAGS) -std=c11 $(NATIVE_FLAGS) $(CIVET_CFLAGS) native/main.c native/core.c native/supervisor.c native/admin.c native/printing.c native/gateway_auto.c src/gateway_config.c -o $@ $(CIVET_LIBS) $(NATIVE_LIBS) -ldl
build/test-native: tests/test_native.c native/core.c native/core.h | build
$(CC) $(CFLAGS) -std=c11 -Inative $(NATIVE_FLAGS) tests/test_native.c native/core.c -o $@ $(NATIVE_LIBS)
check-native: build/test-native
./build/test-native
build/test-supervisor: tests/test_supervisor.c native/supervisor.c native/core.c native/core.h native/supervisor.h | build
$(CC) $(CFLAGS) -std=c11 -DMARS_TESTING -Inative $(NATIVE_FLAGS) tests/test_supervisor.c native/supervisor.c native/core.c -o $@ $(NATIVE_LIBS)
.PHONY: check-supervisor check-web
check-supervisor: build/test-supervisor
./build/test-supervisor
check-web: native
./tests/test_web.sh
build/mars-print: native/print_stdin.c native/rawprint.c native/printing.c native/core.c native/admin.h native/core.h | build
$(CC) $(CFLAGS) -std=c11 $(NATIVE_FLAGS) native/print_stdin.c native/rawprint.c native/printing.c native/core.c -o $@ $(NATIVE_LIBS) -ldl
.PHONY: check-print
check-print: build/test-print build/mars-print
./build/test-print
build/test-print: tests/test_print.c native/printing.c native/core.c native/admin.h | build
$(CC) $(CFLAGS) -std=c11 -Inative $(NATIVE_FLAGS) tests/test_print.c native/printing.c native/core.c -o $@ $(NATIVE_LIBS) -ldl
.PHONY: check-raw
check-raw: build/test-raw
./build/test-raw
build/test-raw: tests/test_raw.c native/rawprint.c | build
$(CC) $(CFLAGS) -std=c11 tests/test_raw.c native/rawprint.c -o $@
.PHONY: check-scripts
check-scripts: build/test-scripts
./build/test-scripts
build/test-scripts: tests/test_scripts.c upstream-adapter/mars_scripts.inc | build
$(CC) $(CFLAGS) -std=c11 $(NATIVE_FLAGS) tests/test_scripts.c -o $@ $(NATIVE_LIBS)
.PHONY: check-trustee
check-trustee: build/test-trustee
./build/test-trustee
build/test-trustee: tests/test_trustee.c upstream-adapter/mars_trustee.inc | build
$(CC) $(CFLAGS) -std=c11 tests/test_trustee.c -o $@
.PHONY: check-gateway
check-gateway: build/test-gateway
./build/test-gateway
build/test-gateway: tests/test_gateway.c src/ipxpkt.c src/gateway_config.c src/gateway.h src/ipxpkt.h | build
$(CC) $(CPPFLAGS) $(CFLAGS) -std=c11 -Isrc tests/test_gateway.c src/ipxpkt.c src/gateway_config.c -o $@ $(shell pkg-config --cflags --libs json-c)
.PHONY: check-gateway-auto
check-gateway-auto: build/test-gateway-auto
./build/test-gateway-auto
build/test-gateway-auto: tests/test_gateway_auto.c native/gateway_auto.c native/gateway_auto.h native/core.c src/dhcp.c src/gateway_config.c src/gateway.h | build
$(CC) $(CPPFLAGS) $(CFLAGS) -std=c11 -Isrc $(NATIVE_FLAGS) tests/test_gateway_auto.c native/gateway_auto.c native/core.c src/dhcp.c src/gateway_config.c -o $@ $(NATIVE_LIBS)
.PHONY: check-winclient
check-winclient: build/test-winclient
./build/test-winclient
build/test-winclient: tests/test_winclient.c clients/windows/client_core.c clients/windows/client_core.h clients/windows/ndis5/frame_queue.c clients/windows/ndis5/frame_queue.h src/ipxpkt.c src/ipxpkt.h src/dhcp.c src/gateway.h | build
$(CC) $(CPPFLAGS) $(CFLAGS) -std=c11 -Isrc -Iclients/windows -Iclients/windows/ndis5 tests/test_winclient.c clients/windows/client_core.c clients/windows/ndis5/frame_queue.c src/ipxpkt.c src/dhcp.c -o $@ $(shell pkg-config --cflags --libs json-c)
# Cross targets are explicitly development candidates, not validated Windows packages.
.PHONY: windows-tools windows-all windows95 windows98 windowsme windowsnt4 windows2000 windowsxp windows-diag windows-watcom windows-nt5
windows-tools:
./cross/install-tools.sh
windows-all:
./build-windows.sh
windows95:
./build-windows.sh --no-install WIN95
windows98:
./build-windows.sh --no-install WIN98
windowsme:
./build-windows.sh --no-install WINME
windowsnt4:
./build-windows.sh --no-install WINNT40
windows2000:
./build-windows.sh --no-install WIN2000
windowsxp:
./build-windows.sh --no-install WINXP
windows-diag:
./cross/build-diag.sh
windows-watcom:
./cross/watcom-check.sh
windows-nt5:
./cross/build-nt5.sh
.PHONY: windows-legacy-tools windows-legacy check-legacy
windows-legacy-tools:
./cross/fetch-legacy.sh --accept-archive
windows-legacy:
./cross/build-legacy.sh
build/test-legacy: tests/test_legacy.c clients/windows/ndis3/legacy_core.c clients/windows/ndis3/legacy_core.h clients/windows/ndis5/frame_queue.c | build
$(CC) $(CFLAGS) -std=c89 -pedantic -DMARS_LEGACY_KERNEL -Iclients/windows/ndis3 tests/test_legacy.c clients/windows/ndis3/legacy_core.c clients/windows/ndis5/frame_queue.c -o $@
check-legacy: build/test-legacy
./build/test-legacy
.PHONY: windows-all-legacy windows-legacy-bridge
windows-all-legacy:
./build-windows.sh --with-legacy-ddk
windows-legacy-bridge:
./cross/build-legacy-bridge.sh