summaryrefslogtreecommitdiffstats
path: root/prog/6/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'prog/6/makefile')
-rw-r--r--prog/6/makefile37
1 files changed, 37 insertions, 0 deletions
diff --git a/prog/6/makefile b/prog/6/makefile
new file mode 100644
index 0000000..8a847a2
--- /dev/null
+++ b/prog/6/makefile
@@ -0,0 +1,37 @@
+DESTDIR=/
+CC=cc
+MYCFLAGS=-O0 -Wall -Wextra -Wformat -pedantic -g
+MYLDFLAGS=-lresolv
+
+default: 6d 6c
+
+6d: daemon.c
+ $(CC) $(MYCFLAGS) $(CFLAGS) $< -o$@ $(MYLDFLAGS) $(LDFLAGS)
+
+6c: client.c
+ $(CC) $(MYCFLAGS) $(CFLAGS) $< -o$@ $(MYLDFLAGS) $(LDFLAGS)
+
+install: 6d 6c
+ mkdir -p $(DESTDIR)/usr/bin/
+ cp 6d $(DESTDIR)/usr/bin/
+ cp 6c $(DESTDIR)/usr/bin/
+
+uninstall:
+ rm -fr $(DESTDIR)/usr/bin/6d
+ rm -fr $(DESTDIR)/usr/bin/6c
+
+distclean: clean
+
+clean:
+ rm -fr 6d 6c
+
+valgrind:
+ valgrind --error-exitcode=59 --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt $(CMD)
+
+# tests if code compiles under gcc, clang and tcc
+cc:
+ make -e CC=tcc
+ make -e CC=gcc
+ make -e CC=clang
+
+.PHONY: default, install, distclean, clean, valgrind, cc, uninstall