From 8197b9b10901bb2f1d7b79d534ce6004349979b5 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 25 Feb 2019 09:10:29 +0200 Subject: Makefile -> GNUmakefile We are GNUmake specific --- GNUmakefile | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 61 ------------------------------------------------------------- 2 files changed, 61 insertions(+), 61 deletions(-) create mode 100644 GNUmakefile delete mode 100644 Makefile diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..edfd4ba --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,61 @@ +PREFIX ?= /usr/local +bindir ?= /bin + +MAKEFLAGS += --no-builtin-rules + +# GCC 7: -Wstringop-overflow=, -Walloc-size-larger-than=, -Wduplicated-{branches,cond} +WARNINGS = -Wall -Wextra -Wpedantic -Wformat=2 -Wstrict-aliasing=3 -Wstrict-overflow=5 -Wstack-usage=12500 \ + -Wfloat-equal -Wcast-align -Wpointer-arith -Wchar-subscripts -Warray-bounds=2 + +override CFLAGS ?= -g -O2 $(WARNINGS) +override CFLAGS += -std=c11 +override CPPFLAGS ?= -D_FORTIFY_SOURCE=2 +override CPPFLAGS += -Isrc +override COLMFLAGS += -Isrc/compiler + +bins = fspec-info fspec-dump dec2bin xidec xi2path xils xifile uneaf +all: $(bins) + +%.c: %.lm + colm $(COLMFLAGS) -c $< + +%.c: %.rl + ragel $^ + +%.a: + $(LINK.c) -c $(filter %.c,$^) $(LDLIBS) -o $@ + +$(bins): %: + $(LINK.c) $(filter %.c %.a,$^) $(LDLIBS) -o $@ + +src/compiler/compiler.c: src/compiler/expr.lm src/compiler/types.lm +fspec-compiler-native.a: private override WARNINGS = -Wno-unusued-parameter +fspec-compiler-native.a: src/compiler/native.c +fspec-compiler.a: private override WARNINGS = +fspec-compiler.a: src/compiler/compiler.c fspec-compiler-native.a + +fspec-info: private override LDLIBS += -lcolm +fspec-info: src/bin/fspec-info.c fspec-compiler.a fspec-compiler-native.a +fspec-dump: src/bin/fspec-dump.c + +dec2bin: src/bin/misc/dec2bin.c + +xidec: private override WARNINGS += -Wno-strict-overflow +xidec: src/bin/xi/xidec.c +xi2path: src/bin/xi/xi2path.c +xils: src/bin/xi/xils.c +xifile: src/bin/xi/xifile.c + +uneaf: private LDLIBS += $(shell pkg-config --libs-only-l zlib) +uneaf: src/bin/fw/uneaf.c + +install-bin: $(bins) + install -Dm755 $^ -t "$(DESTDIR)$(PREFIX)$(bindir)" + +install: install-bin + +clean: + $(RM) src/compiler/compiler.c + $(RM) $(bins) *.a + +.PHONY: all clean install diff --git a/Makefile b/Makefile deleted file mode 100644 index edfd4ba..0000000 --- a/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -PREFIX ?= /usr/local -bindir ?= /bin - -MAKEFLAGS += --no-builtin-rules - -# GCC 7: -Wstringop-overflow=, -Walloc-size-larger-than=, -Wduplicated-{branches,cond} -WARNINGS = -Wall -Wextra -Wpedantic -Wformat=2 -Wstrict-aliasing=3 -Wstrict-overflow=5 -Wstack-usage=12500 \ - -Wfloat-equal -Wcast-align -Wpointer-arith -Wchar-subscripts -Warray-bounds=2 - -override CFLAGS ?= -g -O2 $(WARNINGS) -override CFLAGS += -std=c11 -override CPPFLAGS ?= -D_FORTIFY_SOURCE=2 -override CPPFLAGS += -Isrc -override COLMFLAGS += -Isrc/compiler - -bins = fspec-info fspec-dump dec2bin xidec xi2path xils xifile uneaf -all: $(bins) - -%.c: %.lm - colm $(COLMFLAGS) -c $< - -%.c: %.rl - ragel $^ - -%.a: - $(LINK.c) -c $(filter %.c,$^) $(LDLIBS) -o $@ - -$(bins): %: - $(LINK.c) $(filter %.c %.a,$^) $(LDLIBS) -o $@ - -src/compiler/compiler.c: src/compiler/expr.lm src/compiler/types.lm -fspec-compiler-native.a: private override WARNINGS = -Wno-unusued-parameter -fspec-compiler-native.a: src/compiler/native.c -fspec-compiler.a: private override WARNINGS = -fspec-compiler.a: src/compiler/compiler.c fspec-compiler-native.a - -fspec-info: private override LDLIBS += -lcolm -fspec-info: src/bin/fspec-info.c fspec-compiler.a fspec-compiler-native.a -fspec-dump: src/bin/fspec-dump.c - -dec2bin: src/bin/misc/dec2bin.c - -xidec: private override WARNINGS += -Wno-strict-overflow -xidec: src/bin/xi/xidec.c -xi2path: src/bin/xi/xi2path.c -xils: src/bin/xi/xils.c -xifile: src/bin/xi/xifile.c - -uneaf: private LDLIBS += $(shell pkg-config --libs-only-l zlib) -uneaf: src/bin/fw/uneaf.c - -install-bin: $(bins) - install -Dm755 $^ -t "$(DESTDIR)$(PREFIX)$(bindir)" - -install: install-bin - -clean: - $(RM) src/compiler/compiler.c - $(RM) $(bins) *.a - -.PHONY: all clean install -- cgit v1.2.3-70-g09d2