summaryrefslogblamecommitdiffstats
path: root/prog/6/makefile
blob: 8a847a2e25d49b23f49a29e3223dde7264f39fc9 (plain) (tree)




































                                                                                                                                             
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