From 46d63bca58c9ee8bfc590577ee374614cd813414 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 25 Feb 2019 09:15:55 +0200 Subject: Makefile -> GNUmakefile --- GNUmakefile | 44 ++++++++++++++++++++++++++++++++++++++++++++ Makefile | 44 -------------------------------------------- 2 files changed, 44 insertions(+), 44 deletions(-) create mode 100644 GNUmakefile delete mode 100644 Makefile diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..70df7f1 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,44 @@ +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=3 -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 + +bins = escpos2raster starpbm +all: $(bins) + +%.c: %.rl + ragel $^ + +%.a: + $(LINK.c) -c $(filter %.c,$^) $(LDLIBS) -o $@ + +$(bins): %: + $(LINK.c) $(filter %.c %.a,$^) $(LDLIBS) -o $@ + +escpos-membuf.a: src/escpos/memory.h src/util/membuf.h src/util/membuf.c +escpos-ragel.a: src/util/ragel/ragel.h src/util/ragel/ragel.c +escpos-stack.a: src/escpos/stack.h src/escpos/stack.c +escpos-parser.a: src/escpos/parser.h src/escpos/parser.c src/escpos/utf8.h escpos-stack.a +escpos2raster: src/bin/escpos2raster.c escpos-membuf.a escpos-ragel.a escpos-stack.a escpos-parser.a + +starpbm: src/bin/starpbm.c + +install-bin: $(bins) + install -Dm755 $^ -t "$(DESTDIR)$(PREFIX)$(BINDIR)" + +install: install-bin + +clean: + $(RM) src/util/ragel/ragel.c src/escpos/stack.c src/escpos/parser.c + $(RM) $(bins) *.a + +.PHONY: all clean install diff --git a/Makefile b/Makefile deleted file mode 100644 index 70df7f1..0000000 --- a/Makefile +++ /dev/null @@ -1,44 +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=3 -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 - -bins = escpos2raster starpbm -all: $(bins) - -%.c: %.rl - ragel $^ - -%.a: - $(LINK.c) -c $(filter %.c,$^) $(LDLIBS) -o $@ - -$(bins): %: - $(LINK.c) $(filter %.c %.a,$^) $(LDLIBS) -o $@ - -escpos-membuf.a: src/escpos/memory.h src/util/membuf.h src/util/membuf.c -escpos-ragel.a: src/util/ragel/ragel.h src/util/ragel/ragel.c -escpos-stack.a: src/escpos/stack.h src/escpos/stack.c -escpos-parser.a: src/escpos/parser.h src/escpos/parser.c src/escpos/utf8.h escpos-stack.a -escpos2raster: src/bin/escpos2raster.c escpos-membuf.a escpos-ragel.a escpos-stack.a escpos-parser.a - -starpbm: src/bin/starpbm.c - -install-bin: $(bins) - install -Dm755 $^ -t "$(DESTDIR)$(PREFIX)$(BINDIR)" - -install: install-bin - -clean: - $(RM) src/util/ragel/ragel.c src/escpos/stack.c src/escpos/parser.c - $(RM) $(bins) *.a - -.PHONY: all clean install -- cgit v1.2.3-70-g09d2