189 lines
9.9 KiB
Makefile
189 lines
9.9 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/slp.c src/ncp_ip.c src/ncp_ip_config.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 src/ncp_ip.h src/slp.h | build
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -std=c11 src/broker.c src/slp.c src/ncp_ip.c src/ncp_ip_config.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 src/ncp_ip.h src/ncp_ip_config.c native/identity.c native/identity_api.c native/directory.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 native/directory.h native/identity.h native/identity_api.h | build
|
|
$(CC) $(CFLAGS) -std=c11 $(NATIVE_FLAGS) $(CIVET_CFLAGS) native/main.c src/ncp_ip_config.c native/identity.c native/identity_api.c native/directory.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) -lsqlite3 -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
|
|
|
|
# Optional browser module: independent of upstream MARS and CivetWeb.
|
|
.PHONY: browser-check browser-client browser-smoke
|
|
browser-check:
|
|
node --test browser/test.mjs browser/audio-controller.test.mjs browser/lifecycle.test.mjs
|
|
node --check websetup/app.js
|
|
$(MAKE) -C clients/retro-browser check
|
|
browser-client:
|
|
$(MAKE) -C clients/retro-browser all
|
|
browser-smoke:
|
|
node browser/smoke.mjs
|
|
|
|
.PHONY: check-directory
|
|
check-directory: build/test-directory
|
|
./build/test-directory
|
|
build/test-directory: tests/test_directory.c native/directory.c native/directory.h native/core.c native/core.h | build
|
|
$(CC) $(CFLAGS) -std=c11 -Inative $(NATIVE_FLAGS) tests/test_directory.c native/directory.c native/core.c -o $@ $(NATIVE_LIBS)
|
|
|
|
IDENTITY_WRAPS = $(foreach f,getpwnam getpwuid getpwnam_r getpwuid_r getgrnam getgrgid getgrnam_r getgrgid_r initgroups getgrouplist,-Wl,--wrap=$(f))
|
|
.PHONY: check-identity
|
|
check-identity: build/test-identity build/test-identity-api
|
|
mkdir -p build/identity-test
|
|
chmod 0700 build/identity-test
|
|
./build/test-identity
|
|
./build/test-identity-api
|
|
build/test-identity: tests/test_identity.c native/identity.c native/identity_wrap.c native/identity.h | build
|
|
$(CC) $(CFLAGS) -Werror -std=c11 -Inative -DMARS_WRAPPED -DMARS_ID_TESTING '-DMARS_ID_DB="$(abspath build/identity-test/ids.sqlite3)"' tests/test_identity.c native/identity.c native/identity_wrap.c $(IDENTITY_WRAPS) -lsqlite3 -o $@
|
|
build/test-identity-api: tests/test_identity_api.c native/identity.c native/identity_api.c native/core.c | build
|
|
$(CC) $(CFLAGS) -Werror -std=c11 -Inative $(NATIVE_FLAGS) -DMARS_ID_TESTING '-DMARS_ID_DB="$(abspath build/identity-test/api.sqlite3)"' tests/test_identity_api.c native/identity.c native/identity_api.c native/core.c $(NATIVE_LIBS) -lsqlite3 -o $@
|
|
|
|
.PHONY: check-nds-frag
|
|
check-nds-frag: build/test-nds-frag
|
|
./build/test-nds-frag
|
|
build/test-nds-frag: tests/test_nds_frag.c nds/fragger.c nds/fragger.h | build
|
|
$(CC) $(CFLAGS) -Werror -std=c11 -Inds tests/test_nds_frag.c nds/fragger.c -o $@
|
|
|
|
.PHONY: check-release
|
|
check-release: check check-native check-supervisor check-gateway check-gateway-auto check-winclient check-legacy check-print check-raw check-directory check-identity check-scripts check-trustee check-nds-frag browser-check
|
|
node tests/test_directory_ui.cjs
|
|
python3 tests/test_dos_export.py
|
|
|
|
.PHONY: check-ncp-ip check-ncp-ip-integration
|
|
build/test-ncp-ip-config: tests/test_ncp_ip_config.c src/ncp_ip_config.c src/ncp_ip.h | build
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -Werror -std=c11 -Isrc tests/test_ncp_ip_config.c src/ncp_ip_config.c -o $@ $(shell pkg-config --cflags --libs json-c)
|
|
build/test-ncp-ip: tests/test_ncp_ip.c build/libmarspcap.a | build
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -Werror -std=c11 -Isrc tests/test_ncp_ip.c build/libmarspcap.a -o $@
|
|
check-ncp-ip: build/test-ncp-ip-config
|
|
./build/test-ncp-ip-config
|
|
check-ncp-ip-integration: build/test-ncp-ip build/mars-pcapd
|
|
./tests/run_ncp_ip.sh
|
|
check-release: check-ncp-ip
|
|
|
|
check-ncp-ip: check-ncp-ip-ui
|
|
.PHONY: check-ncp-ip-ui
|
|
check-ncp-ip-ui:
|
|
node tests/test_ncp_ip_ui.cjs
|
|
|
|
.PHONY: check-slp
|
|
build/test-slp: tests/test_slp.c src/slp.c src/slp.h src/wire.h | build
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -Werror -std=c11 -Isrc tests/test_slp.c src/slp.c -o $@
|
|
check-slp: build/test-slp
|
|
./build/test-slp
|
|
check-release: check-slp
|