From 8d6359867cb6bbed1edbd1de475caaa72c8427ab Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Mon, 22 May 2017 17:01:47 +0100 Subject: wip --- Makefile | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'Makefile') 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) -- cgit v1.2.3-54-g00ecf