summaryrefslogblamecommitdiffstats
path: root/Makefile
blob: 2007c1b0cae87ec50328d7268a9bdbbc5abcb36a (plain) (tree)
1
2
3
4
5
6
7
8
9
10









                                                                                                  


                                                                               
                                      
                                               













                                                                                                                             
DESTDIR=/
CC = cc
cflags = -O0 -Wall -I. -fpic -Wformat-security -Wextra -pedantic -g3
ldflags = $(shell pkg-config --libs sqlite3) -lmicrohttpd # -lintl
PROJ = prijave
# cflags and ldflags are used so that users specifying CFLAGS and LDFLAGS do not override my flags
# += is not used, because gcc usually accepts last option, for example -O0 -O2 will use -O2
.NOTPARALLEL:
default:
	$(CC) -L. $(cflags) $(CFLAGS) $(PROJ).c $(ldflags) $(LDFLAGS) -o$(PROJ)

install: default
	mkdir -p $(DESTDIR)/usr/bin $(DESTDIR)/etc $(DESTDIR)/usr/share/$(PROJ)
	cp $(PROJ) $(DESTDIR)/usr/bin/
	cp *.html $(DESTDIR)/usr/share/$(PROJ)/
	-[ ! -f $(DESTDIR)/etc/$(PROJ) ] && cp $(PROJ).conf $(DESTDIR)/etc/$(PROJ)

distclean: clean

clean:
	rm -f $(PROJ)

uninstall:
	rm -f $(DESTDIR)/usr/bin/$(PROJ)

valgrind:
	valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt $(COMMAND)

.PHONY: valgrind clean distclean install uninstall default