From 464847c5b25588448e550017a6d91447c076b944 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Wed, 23 Nov 2016 21:23:09 +0000 Subject: init commit --- Makefile | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f1abf21 --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +VERSION != git describe --tags 2>/dev/null || echo "0.1" +PROG := hktool +MANPAGE := hktool.1 + +WARNINGS := -Wall -Wcast-align -Wcast-qual -Wextra -Wpedantic -Wformat=2 \ + -Winit-self -Wmissing-prototypes -Wpointer-arith -Wshadow \ + -Wstrict-prototypes -Wsuggest-attribute=format \ + -Wsuggest-attribute=noreturn + +PKG_CONFIG ?= pkg-config + +LIBS := libusb-1.0 +CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_POSIX_C_SOURCE=200809L +CFLAGS = -std=c11 -O2 -flto $(WARNINGS) -MMD -MP $(shell $(PKG_CONFIG) --cflags $(LIBS)) +LDFLAGS = -Wl,--as-needed -O2 -flto +LDLIBS = $(shell $(PKG_CONFIG) --libs $(LIBS)) + +OBJ := hktool.o halfkay.o log.o params.o util.o + +PREFIX ?= /usr/local + +bindir = /bin +datarootdir = /share +mandir = /man + +all: $(PROG) +$(PROG): $(OBJ) + +debug: all +debug: CFLAGS += -ggdb -Og -Werror +debug: LDFLAGS += -ggdb -Og + +install: $(PROG) $(MANPAGE) + install -Dm755 -s $(PROG) $(DESTDIR)$(PREFIX)$(bindir) + install -Dm644 ./data/* -t $(DESTDIR)$(PREFIX)$(datarootdir)/$(PROG)/ + install -Dm644 $(MANPAGE) $(DESTDIR)$(PREFIX)$(mandir)/man1/ + +clean: + $(RM) $(OBJ) $(OBJ:.o=.d) $(PROG) + +-include $(OBJ:.o=.d) + +.PHONY: all debug install clean -- cgit v1.2.3-54-g00ecf