summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to '')
-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