summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-04-30 02:10:29 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2022-04-30 02:10:29 +0200
commit743086cf4e69c77e139c23defaf63bfa403c1678 (patch)
tree752cb5c0427ea9ea306ee200f0b1148a8fa33ab2 /Makefile
parentoh, looh, security issues already (diff)
downloadircxmpp-743086cf4e69c77e139c23defaf63bfa403c1678.tar
ircxmpp-743086cf4e69c77e139c23defaf63bfa403c1678.tar.gz
ircxmpp-743086cf4e69c77e139c23defaf63bfa403c1678.tar.bz2
ircxmpp-743086cf4e69c77e139c23defaf63bfa403c1678.tar.lz
ircxmpp-743086cf4e69c77e139c23defaf63bfa403c1678.tar.xz
ircxmpp-743086cf4e69c77e139c23defaf63bfa403c1678.tar.zst
ircxmpp-743086cf4e69c77e139c23defaf63bfa403c1678.zip
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 16 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 19eccb9..5510ba7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,29 +1,31 @@
DESTDIR=/
CC = cc
-cflags = -O0 -Wall -I. -Wformat-security -Wextra -pedantic -g $(shell pkg-config --cflags libstrophe)
-SRCFILE = main.c
-CFGFILE = ircxmpp.conf
-CFGDEST = ircxmpp
+cflags = -O0 -Wall -I. -fpic -Wformat-security -Wextra -pedantic -g3 $(shell pkg-config --cflags libstrophe)
ldflags = $(shell pkg-config --libs libstrophe) -lircclient
-BINFILE = ircxmpp
+PROJ = 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)
-
+ $(CC) -c -DIX_LIB $(cflags) $(CFLAGS) $(PROJ).c
+ $(CC) -shared -olib$(PROJ).so $(PROJ).o
+ $(CC) -L. $(cflags) $(CFLAGS) $(PROJ).c -l$(PROJ) $(ldflags) $(LDFLAGS) -o$(PROJ)
install:
- mkdir -p $(DESTDIR)/usr/bin $(DESTDIR)/etc
- cp $(BINFILE) $(DESTDIR)/usr/bin/
- cp $(CFGFILE) $(DESTDIR)/etc/$(CFGDEST)
+ mkdir -p $(DESTDIR)/usr/bin $(DESTDIR)/etc $(DESTDIR)/usr/include $(DESTDIR)/usr/lib
+ cp $(PROJ) $(DESTDIR)/usr/bin/
+ cp $(PROJ).conf $(DESTDIR)/etc/$(PROJ)
+ cp lib$(PROJ).so $(DESTDIR)/usr/lib/
+ cp $(PROJ).h $(DESTDIR)/usr/include/
-distclean:
- rm $(BINFILE) tmp -rf
+distclean: clean
clean:
- rm $(BINFILE) tmp -rf
+ rm $(PROJ) $(PROJ).o lib$(PROJ).so
+
+uninstall:
+ rm $(DESTDIR)/usr/bin/$(PROJ) $(DESTDIR)/etc/$(PROJ) $(DESTDIR)/usr/include/$(PROJ).h $(DESTDIR)/usr/lib/lib$(PROJ).so
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
+.PHONY: valgrind clean distclean install uninstall default