diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2016-11-23 21:23:09 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2016-11-23 21:23:30 +0000 |
commit | 464847c5b25588448e550017a6d91447c076b944 (patch) | |
tree | cb48ce0793232ab0046ac1ad18ad50862ed77f5c /Makefile | |
download | hktool-464847c5b25588448e550017a6d91447c076b944.tar.gz hktool-464847c5b25588448e550017a6d91447c076b944.tar.xz hktool-464847c5b25588448e550017a6d91447c076b944.zip |
init commit
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 43 |
1 files changed, 43 insertions, 0 deletions
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 |