aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 1f7fb60fe508d3f78bb8796a10b35f4b92601331 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
CPPFLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE
CFLAGS += -Wall -pedantic -W -Werror -ansi -Wfloat-equal -Wundef \
         -Wpointer-arith -Wcast-align -Wwrite-strings \
         -Wswitch-default -Wunreachable-code ${CPPFLAGS}
PREFIX=/usr/local
MANPREFIX=$(PREFIX)/share/man
ifeq (${DEBUG}, 1)
	CFLAGS += -ggdb
endif

.PHONY: all clean install uninstall

all: shtpl

shtpl: shtpl.c
	$(CC) $(CFLAGS) -o $@ $^

memcheck:
	valgrind --leak-check=full ./shtpl <test

install: shtpl
	mkdir -p $(DESTDIR)$(PREFIX)/bin
	cp -f shtpl $(DESTDIR)$(PREFIX)/bin
	chmod 755 $(DESTDIR)$(PREFIX)/bin/shtpl
	mkdir -p $(DESTDIR)$(MANPREFIX)/man1
	cp -f shtpl.1 $(DESTDIR)$(MANPREFIX)/man1
	chmod 644 $(DESTDIR)$(MANPREFIX)/man1/shtpl.1

uninstall:
	rm -f $(DESTDIR)$(PREFIX)/bin/shtpl
	rm -f $(DESTDIR)$(MANPREFIX)/bin/shtpl.1

clean:
	rm shtpl