shrub/pkg/urbit/Makefile

88 lines
2.2 KiB
Makefile
Raw Normal View History

2019-03-05 03:43:53 +03:00
include config.mk
jets = jets/tree.c $(wildcard jets/*/*.c)
noun = $(wildcard noun/*.c)
vere = $(wildcard vere/*.c)
daemon = $(wildcard daemon/*.c)
worker = $(wildcard worker/*.c)
2019-03-05 03:43:53 +03:00
common = $(jets) $(noun) $(vere)
headers = $(shell find include -type f) include/ca-bundle.h
2019-03-05 03:43:53 +03:00
common_objs = $(shell echo $(common) | sed 's/\.c/.o/g')
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
all_objs = $(common_objs) $(daemon_objs) $(worker_objs)
all_srcs = $(common) $(daemon) $(worker)
all_exes = ./build/mug_tests ./build/jam_tests ./build/hashtable_tests \
./build/urbit ./build/urbit-worker
2019-03-05 03:43:53 +03:00
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)
CFLAGS := $(CFLAGS)
2019-04-26 01:23:53 +03:00
ifeq ($(SSL_CERT_FILE),)
$(error SSL_CERT_FILE is undefined)
endif
2019-04-26 01:23:53 +03:00
2019-03-05 03:43:53 +03:00
################################################################################
.PHONY: all test clean mkproper
2019-03-05 03:43:53 +03:00
################################################################################
all: $(all_exes)
test: build/hashtable_tests build/jam_tests build/mug_tests
./build/hashtable_tests
./build/jam_tests
./build/mug_tests
2019-03-05 03:43:53 +03:00
clean:
rm -f ./tags $(all_objs) $(all_exes)
2019-03-05 03:43:53 +03:00
mrproper: clean
rm -f config.mk include/config.h include/ca-bundle.h
2019-03-05 03:43:53 +03:00
################################################################################
include/ca-bundle.h:
@echo XXD -i $(SSL_CERT_FILE)
@cat $(SSL_CERT_FILE) > include/ca-bundle.crt
@xxd -i include/ca-bundle.crt > include/ca-bundle.h
@rm include/ca-bundle.crt
build/hashtable_tests: $(common_objs) tests/hashtable_tests.o
@echo CC -o $@
@mkdir -p ./build
@$(CC) $^ $(LDFLAGS) -o $@
build/jam_tests: $(common_objs) tests/jam_tests.o
2019-05-12 12:29:13 +03:00
@echo CC -o $@
@mkdir -p ./build
2019-05-12 12:29:13 +03:00
@$(CC) $^ $(LDFLAGS) -o $@
build/mug_tests: $(common_objs) tests/mug_tests.o
@echo CC -o $@
@mkdir -p ./build
@$(CC) $^ $(LDFLAGS) -o $@
build/urbit: $(common_objs) $(daemon_objs)
2019-03-05 03:43:53 +03:00
@echo CC -o $@
@mkdir -p ./build
2019-03-05 03:43:53 +03:00
@$(CC) $^ $(LDFLAGS) -o $@
build/urbit-worker: $(common_objs) $(worker_objs)
2019-03-05 03:43:53 +03:00
@echo CC -o $@
@mkdir -p ./build
2019-03-05 03:43:53 +03:00
@$(CC) $^ $(LDFLAGS) -o $@
%.o: %.c $(headers)
@echo CC $<
@$(CC) -I./include $(CFLAGS) -c $< -o $@
tags: $(all_srcs) $(headers)
ctags $^