aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2017-05-22 17:01:47 +0100
committerTomasz Kramkowski <tk@the-tk.com>2017-05-23 13:34:35 +0100
commit8d6359867cb6bbed1edbd1de475caaa72c8427ab (patch)
tree2c73387059d69aeadd5557917c31874909acd7f0 /Makefile
parente2b122f129b969633ba4ca1ca15b21ee13db7f19 (diff)
downloadhktool-8d6359867cb6bbed1edbd1de475caaa72c8427ab.tar.gz
hktool-8d6359867cb6bbed1edbd1de475caaa72c8427ab.tar.xz
hktool-8d6359867cb6bbed1edbd1de475caaa72c8427ab.zip
wip
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile26
1 files changed, 15 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 8871eaa..d460268 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
VERSION != git describe --tags 2>/dev/null || echo "0.1"
PROG := hktool
-MANPAGE := hktool.1
+MANPAGE := $(PROG).1
WARNINGS := -Wall -Wcast-align -Wcast-qual -Wextra -Wpedantic -Wformat=2 \
-Winit-self -Wmissing-prototypes -Wpointer-arith -Wshadow \
@@ -10,33 +10,37 @@ WARNINGS := -Wall -Wcast-align -Wcast-qual -Wextra -Wpedantic -Wformat=2 \
PKG_CONFIG ?= pkg-config
LIBS := libusb-1.0
-CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_POSIX_C_SOURCE=200112L
+CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_POSIX_C_SOURCE=200112L -DDATADIR=\"$(datarootdir)/$(PROG)\"
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 params.o util.o eprintf.o
-PREFIX ?= /usr/local
+prefix ?= /usr/local
+exec_prefix ?= $(prefix)
-bindir = /bin
-datarootdir = /share
-mandir = /man
+bindir = $(exec_prefix)/bin
+datarootdir = $(prefix)/share
+mandir = $(datarootdir)/man
+man1dir = $(mandir)/man1
-all: $(PROG)
+all: $(PROG) $(MANPAGE)
$(PROG): $(OBJ)
+%: %.in
+ $(CPP) $(CPPFLAGS) $< > $@
debug: all
debug: CFLAGS += -ggdb -Og -Werror
debug: LDFLAGS += -ggdb -Og
install: $(PROG) $(MANPAGE)
- install -Dm755 -s $(PROG) -t $(DESTDIR)$(PREFIX)$(bindir)
- install -Dm644 ./data/* -t $(DESTDIR)$(PREFIX)$(datarootdir)/$(PROG)
- install -Dm644 $(MANPAGE) -t $(DESTDIR)$(PREFIX)$(mandir)/man1
+ install -Dm755 -s $(PROG) -t $(DESTDIR)$(bindir)
+ install -Dm644 ./data/* -t $(DESTDIR)$(datarootdir)/$(PROG)
+ install -Dm644 $(MANPAGE) -t $(DESTDIR)$(man1dir)
clean:
- $(RM) $(OBJ) $(OBJ:.o=.d) $(PROG)
+ $(RM) $(OBJ) $(OBJ:.o=.d) $(PROG) $(MANPAGE)
-include $(OBJ:.o=.d)