diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 42 |
1 files changed, 21 insertions, 21 deletions
@@ -87,13 +87,7 @@ CFLAGS+=$(CCONFIG) $(INCLUDE_DIRS) $(EXTRA) $(CWARN) $(G) $(O) $(OSFLAGS) $(LTO) -DSUDO='"$(SUDO)"' -DDEFAULT_C_COMPILER='"$(DEFAULT_C_COMPILER)"' \ -DGIT_VERSION='"$(GIT_VERSION)"' -ffunction-sections -fdata-sections CFLAGS_PLACEHOLDER="$$(printf '\033[2m<flags...>\033[m\n')" -LDLIBS=-lgc -lm -lunistring -lgmp - -ifeq ($(OS),OpenBSD) - LDLIBS += -lexecinfo -else - LDLIBS += -ldl -endif +LDLIBS=-lm AR_FILE=libtomo@$(TOMO_VERSION).a ifeq ($(OS),Darwin) @@ -103,12 +97,12 @@ endif EXE_FILE=tomo@$(TOMO_VERSION) COMPILER_OBJS=$(patsubst %.c,%.o,$(wildcard src/*.c src/compile/*.c src/parse/*.c src/formatter/*.c)) -STDLIB_OBJS=$(patsubst %.c,%.o,$(wildcard src/stdlib/*.c)) +STDLIB_OBJS=$(patsubst %.c,%.o,$(wildcard src/stdlib/*.c)) src/print.o TESTS=$(patsubst test/%.tm,test/results/%.tm.testresult,$(wildcard test/[!_]*.tm)) API_YAML=$(wildcard api/*.yaml) API_MD=$(patsubst %.yaml,%.md,$(API_YAML)) -all: config.mk check-c-compiler check-libs build +all: config.mk check-c-compiler build @$(ECHO) "All done!" BUILD_DIR=build/tomo@$(TOMO_VERSION) @@ -141,12 +135,16 @@ $(BUILD_DIR)/man/%.gz: man/% | $(BUILD_DIR)/man/man1 $(BUILD_DIR)/man/man3 $(BUILD_DIR)/bin/tomo: $(BUILD_DIR)/bin/tomo@$(TOMO_VERSION) | $(BUILD_DIR)/bin ln -sf tomo@$(TOMO_VERSION) $@ -$(BUILD_DIR)/bin/$(EXE_FILE): $(STDLIB_OBJS) $(COMPILER_OBJS) | $(BUILD_DIR)/bin - @$(ECHO) $(CC) $(CFLAGS_PLACEHOLDER) $(LDFLAGS) $^ $(LDLIBS) -o $@ - @$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@ +$(BUILD_DIR)/bin/$(EXE_FILE): $(STDLIB_OBJS) $(COMPILER_OBJS) build/gc/lib/libgc.a build/gmp/lib/libgmp.a build/unistring/lib/libunistring.a | $(BUILD_DIR)/bin deps + @$(ECHO) $(CC) $(CFLAGS_PLACEHOLDER) $(LDFLAGS) $(LDLIBS) $^ -o $@ + @$(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) $^ -o $@ -$(BUILD_DIR)/lib/$(AR_FILE): $(STDLIB_OBJS) | $(BUILD_DIR)/lib - ar -rcs $@ $^ +$(BUILD_DIR)/lib/$(AR_FILE): $(STDLIB_OBJS) build/gc/lib/libgc.a build/unistring/lib/libunistring.a build/gmp/lib/libgmp.a | $(BUILD_DIR)/lib + $(CC) -no-pie -r -flto -nostdlib \ + src/stdlib/*.o src/print.o \ + build/gc/lib/libgc.a build/gmp/lib/libgmp.a build/unistring/lib/libunistring.a \ + -o libtomo.o + ar rcs $@ libtomo.o $(BUILD_DIR)/lib/tomo@$(TOMO_VERSION)/modules.ini: modules/core.ini modules/examples.ini | $(BUILD_DIR)/lib/tomo@$(TOMO_VERSION) @cat $^ > $@ @@ -165,9 +163,9 @@ check-c-compiler: @$(DEFAULT_C_COMPILER) -v 2>/dev/null >/dev/null \ || { printf '\033[31;1m%s\033[m\n' "You have set your DEFAULT_C_COMPILER to $(DEFAULT_C_COMPILER) in your config.mk, but I can't run it!"; exit 1; } -check-libs: check-c-compiler - @echo 'int main() { return 0; }' | $(DEFAULT_C_COMPILER) $(LDFLAGS) $(LDLIBS) -x c - -o /dev/null 2>/dev/null >/dev/null \ - || { printf '\033[31;1m%s\033[m\n' "I expected to find the following libraries on your system, but I can't find them: $(LDLIBS)"; exit 1; } +# check-libs: check-c-compiler | deps +# @echo 'int main() { return 0; }' | $(DEFAULT_C_COMPILER) $(LDFLAGS) -x c - $(LDLIBS) -o /dev/null 2>/dev/null >/dev/null \ +# || { printf '\033[31;1m%s\033[m\n' "I expected to find the following libraries on your system, but I can't find them: $(LDLIBS)"; exit 1; } tags: ctags src/*.{c,h} src/stdlib/*.{c,h} src/compile/*.{c,h} src/parse/*.{c,h} src/formatter/*.{c,h} @@ -200,7 +198,7 @@ test: $(TESTS) @printf '\033[32;7m ALL TESTS PASSED! \033[m\n' clean: - rm -rf build/* $(COMPILER_OBJS) $(STDLIB_OBJS) test/*.tm.testresult test/.build lib/*/.build examples/.build examples/*/.build + rm -rf build/tomo*/{bin,lib} $(COMPILER_OBJS) $(STDLIB_OBJS) test/*.tm.testresult test/.build lib/*/.build examples/.build examples/*/.build %: %.md pandoc --lua-filter=docs/.pandoc/bold-code.lua -s $< -t man -o $@ @@ -228,8 +226,10 @@ examples: core-libs: ./local-tomo -L modules/core.ini -deps: - bash ./install_dependencies.sh +deps: build/gc/lib/libgc.a build/unistring/lib/libgc.a build/gmp/lib/libgmp.a + +build/gc/lib/libgc.a build/unistring/lib/libgc.a build/gmp/lib/libgmp.a: + $(MAKE) -C vendor check-utilities: check-c-compiler @which debugedit 2>/dev/null >/dev/null \ @@ -263,4 +263,4 @@ uninstall: endif .SUFFIXES: -.PHONY: all build clean install install-files uninstall test tags core-libs examples deps check-utilities check-c-compiler check-libs version +.PHONY: all build clean install install-files uninstall test tags core-libs examples deps check-utilities check-c-compiler version |
