summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 26f6f022e53e12d7aeaf48dc407ab2e836205b3c (plain) (blame)
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
DESTDIR=/
CC = cc
cflags = -O0 -Wall -I. -Wextra -pedantic -g $(shell pkg-config --cflags libstrophe)
SRCFILE = main.c
CFGFILE = ircxmpp.conf
CFGDEST = ircxmpp
ldflags = $(shell pkg-config --libs libstrophe) -lircclient
BINFILE = ircxmpp
# 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) $(cflags) $(CFLAGS) $(SRCFILE) $(ldflags) $(LDFLAGS) -o$(BINFILE)

install:
	mkdir -p $(DESTDIR)/usr/bin $(DESTDIR)/etc
	cp $(BINFILE) $(DESTDIR)/usr/bin/
	cp $(CFGFILE) $(DESTDIR)/etc/$(CFGDEST)

distclean:
	rm $(BINFILE) tmp -rf

clean:
	rm $(BINFILE) tmp -rf

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

.PHONY: valgrind clean distclean install default