2019-03-05 03:43:53 +03:00
|
|
|
include config.mk
|
2021-06-03 00:59:08 +03:00
|
|
|
include $(foreach dir,$(compat),$(wildcard compat/$(dir)/*.mk))
|
2019-03-05 03:43:53 +03:00
|
|
|
|
|
|
|
jets = jets/tree.c $(wildcard jets/*/*.c)
|
|
|
|
noun = $(wildcard noun/*.c)
|
2020-07-29 01:52:32 +03:00
|
|
|
ur = $(wildcard ur/*.c)
|
2020-04-22 09:55:17 +03:00
|
|
|
vere = $(wildcard vere/*.c) $(wildcard vere/*/*.c)
|
2019-04-12 23:30:36 +03:00
|
|
|
daemon = $(wildcard daemon/*.c)
|
|
|
|
worker = $(wildcard worker/*.c)
|
2019-12-10 22:14:11 +03:00
|
|
|
tests = $(wildcard tests/*.c)
|
2020-08-28 08:26:14 +03:00
|
|
|
bench = $(wildcard bench/*.c)
|
2019-03-05 03:43:53 +03:00
|
|
|
|
2021-03-31 13:29:45 +03:00
|
|
|
compat := $(foreach dir,$(compat),$(wildcard compat/$(dir)/*.c))
|
2021-03-28 22:27:26 +03:00
|
|
|
|
|
|
|
common = $(jets) $(noun) $(ur) $(vere) $(compat)
|
2019-08-02 23:51:38 +03:00
|
|
|
headers = $(shell find include -type f)
|
2019-03-05 03:43:53 +03:00
|
|
|
|
|
|
|
common_objs = $(shell echo $(common) | sed 's/\.c/.o/g')
|
2019-04-12 23:30:36 +03:00
|
|
|
daemon_objs = $(shell echo $(daemon) | sed 's/\.c/.o/g')
|
|
|
|
worker_objs = $(shell echo $(worker) | sed 's/\.c/.o/g')
|
2019-03-05 03:43:53 +03:00
|
|
|
|
2019-04-12 23:30:36 +03:00
|
|
|
all_objs = $(common_objs) $(daemon_objs) $(worker_objs)
|
|
|
|
all_srcs = $(common) $(daemon) $(worker)
|
2019-12-10 22:14:11 +03:00
|
|
|
|
2020-08-28 08:26:14 +03:00
|
|
|
test_exes = $(shell echo $(tests) | sed 's/tests\//.\/build\//g' | sed 's/\.c//g')
|
|
|
|
bench_exes = $(shell echo $(bench) | sed 's/bench\//.\/build\//g' | sed 's/\.c//g')
|
2022-04-10 05:25:17 +03:00
|
|
|
all_exes = $(test_exes) $(bench_exes) ./build/urbit
|
2019-04-26 01:23:53 +03:00
|
|
|
|
|
|
|
# -Werror promotes all warnings that are enabled into errors (this is on)
|
|
|
|
# -Wall issues all types of errors. This is off (for now)
|
2019-05-02 23:13:48 +03:00
|
|
|
CFLAGS := $(CFLAGS)
|
2019-04-26 01:23:53 +03:00
|
|
|
|
2019-03-05 03:43:53 +03:00
|
|
|
################################################################################
|
|
|
|
|
2021-06-03 00:59:08 +03:00
|
|
|
.PHONY: all test clean mrproper
|
2019-03-05 03:43:53 +03:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
2019-06-28 23:29:03 +03:00
|
|
|
all: $(all_exes)
|
2019-04-25 03:27:27 +03:00
|
|
|
|
2019-12-10 22:14:11 +03:00
|
|
|
test: $(test_exes)
|
2019-12-18 11:19:37 +03:00
|
|
|
@FAIL=0; \
|
|
|
|
for x in $^; \
|
2021-12-26 22:48:04 +03:00
|
|
|
do echo $$'\n'"$$x" && ./$$x; \
|
2019-12-18 11:19:37 +03:00
|
|
|
if [ $$? != 0 ]; then FAIL=1; fi; \
|
|
|
|
done; \
|
|
|
|
if [ $$FAIL != 0 ]; then echo "\n" && exit 1; fi;
|
2019-03-05 03:43:53 +03:00
|
|
|
|
2020-08-28 08:26:14 +03:00
|
|
|
bench: $(bench_exes)
|
|
|
|
build/ur_bench
|
|
|
|
|
2019-03-05 03:43:53 +03:00
|
|
|
clean:
|
2019-04-25 03:27:27 +03:00
|
|
|
rm -f ./tags $(all_objs) $(all_exes)
|
2019-03-05 03:43:53 +03:00
|
|
|
|
|
|
|
mrproper: clean
|
2019-08-02 23:51:38 +03:00
|
|
|
rm -f config.mk include/config.h
|
2019-03-05 03:43:53 +03:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
2020-08-28 08:26:14 +03:00
|
|
|
build/ur_bench: $(common_objs) bench/ur_bench.o
|
|
|
|
@echo CC -o $@
|
|
|
|
@mkdir -p ./build
|
|
|
|
@$(CC) $^ $(LDFLAGS) -o $@
|
|
|
|
|
2019-12-10 22:14:11 +03:00
|
|
|
build/%_tests: $(common_objs) tests/%_tests.o
|
2019-09-08 01:37:39 +03:00
|
|
|
@echo CC -o $@
|
|
|
|
@mkdir -p ./build
|
|
|
|
@$(CC) $^ $(LDFLAGS) -o $@
|
|
|
|
|
2022-04-10 05:25:17 +03:00
|
|
|
build/urbit: $(common_objs) $(daemon_objs) $(worker_objs)
|
2019-03-05 03:43:53 +03:00
|
|
|
@echo CC -o $@
|
2019-06-28 23:29:03 +03:00
|
|
|
@mkdir -p ./build
|
2019-03-05 03:43:53 +03:00
|
|
|
@$(CC) $^ $(LDFLAGS) -o $@
|
|
|
|
|
2021-06-05 10:22:07 +03:00
|
|
|
# CCDEPS and CCEXTRA are empty except in MingW build,
|
|
|
|
# which uses them to inject a C source transform step
|
2021-06-03 01:45:50 +03:00
|
|
|
%.o: %.c $(headers) $(CCDEPS)
|
2019-03-05 03:43:53 +03:00
|
|
|
@echo CC $<
|
2021-06-03 01:45:50 +03:00
|
|
|
@$(CC) -I./include $(CFLAGS) $< $(CCEXTRA) -c -o $@
|
2019-03-05 03:43:53 +03:00
|
|
|
|
|
|
|
tags: $(all_srcs) $(headers)
|
|
|
|
ctags $^
|