X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=makefile;h=f50f07445b9229007b7df637a2df4241953d08a8;hb=036dfbeb26c5d8b938231a8311f768e32c7cb2ed;hp=08012b62af8ce77ec0b9d175d79b2593aee50cd2;hpb=c222556b46998f2eb2466ded089c1b01091c88a6;p=lackey diff --git a/makefile b/makefile index 08012b6..f50f074 100644 --- a/makefile +++ b/makefile @@ -1,38 +1,63 @@ +# lackey - curses calendar program +# See COPYING file for license details. + -include config.mk # Settings -CC ?= gcc -CFLAGS ?= -Wall --std=c99 -CPPFLAGS ?= -Isrc -LDFLAGS ?= -lncursesw +VERSION ?= 0.1-rc1 +PREFIX ?= /usr/local +MANPREFIX ?= $(PREFIX)/share/man + +# Compiler +GCC ?= gcc +CFLAGS ?= -Wall --std=c99 +CPPFLAGS ?= -Isrc +LDFLAGS ?= -lncursesw -lical # Sources -PROG = lackey -TEST = test -SOURCES = main screen event util -TESTS = test util -VIEWS = day week month year todo notes settings help -CALS = dummy +PROG ?= lackey +PROG_SRC ?= main view date cal args conf util +TEST ?= test +TEST_SRC ?= test date cal conf util +VIEWS ?= day week month year events todo settings help edit +CALS ?= dummy ical + +# For ncursesw +CPPFLAGS += $(strip $(shell pkg-config --cflags ncursesw)) # Targets -all: $(PROG) $(TEST) +all: $(PROG) + +clean: + rm -f src/*.o views/*.o cals/*.o $(PROG) $(TEST) -run-$(PROG): $(PROG) - @urxvt -e ./$< - @cat /tmp/lackey.log +dist: + tar -czf $(PROG)-$(VERSION).tar.gz --transform s::$(PROG)-$(VERSION)/: \ + README COPYING config.mk.example makefile */*.txt */*.1 */*.c */*.h -run-$(TEST): $(TEST) - ./$< +install: all + install -m 755 -D $(PROG) $(DESTDIR)$(PREFIX)/bin/$(PROG) + install -m 644 -D doc/$(PROG).1 $(DESTDIR)$(MANPREFIX)/man1/$(PROG).1 -clean: - rm -f src/*.o view/*.o $(PROG) $(TEST) +uninstall: + rm -f $(DESTDIR)$(PREFIX)/bin/$(PROG) + rm -f $(DESTDIR)$(MANPREFIX)/man1/$(PROG).1 + +memcheck: $(PROG) + valgrind --log-file=valgrind.out \ + --track-origins=yes \ + --leak-check=full \ + --leak-resolution=high \ + ./$(PROG) # Rules -$(PROG): $(SOURCES:%=src/%.o) $(VIEWS:%=view/%.o) $(CALS:%=cal/%.o) - $(CC) $(CFLAGS) -o $@ $+ $(LDFLAGS) +$(PROG): $(PROG_SRC:%=src/%.o) $(VIEWS:%=views/%.o) $(CALS:%=cals/%.o) + $(GCC) $(CFLAGS) -o $@ $+ $(LDFLAGS) + +$(TEST): $(TEST_SRC:%=src/%.o) $(CALS:%=cals/%.o) + $(GCC) $(CFLAGS) -o $@ $+ $(LDFLAGS) -$(TEST): $(TESTS:%=src/%.o) $(VIEWS:%=view/%.o) $(CALS:%=cal/%.o) - $(CC) $(CFLAGS) -o $@ $+ $(LDFLAGS) +%.o: %.c $(wildcard src/*.h makefile config.mk) + $(GCC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< -%.o: %.c $(SOURCES:%=src/%.h) makefile - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< +.PHONY: all clean dist install uninstall