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=200112L 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 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) -t $(DESTDIR)$(PREFIX)$(bindir) install -Dm644 ./data/* -t $(DESTDIR)$(PREFIX)$(datarootdir)/$(PROG) install -Dm644 $(MANPAGE) -t $(DESTDIR)$(PREFIX)$(mandir)/man1 clean: $(RM) $(OBJ) $(OBJ:.o=.d) $(PROG) -include $(OBJ:.o=.d) .PHONY: all debug install clean