summaryrefslogblamecommitdiffstats
path: root/makefile
blob: a348ba33950f6b3b0d4ca504899f5a6b91e95c5c (plain) (tree)
1
2
3
4
5
6
7
8
9

         
                                                                                                                                                                                                                   
                       


                    

                                                                                



                                                                   















                                                                                                                                             
                                                              
DESTDIR=/
CC=cc
MYCFLAGS=-DHARDCODED_DNS=`(host ipv6.sijanec.eu || echo no_host_program_on_build_host) | tail -n1 | rev | cut -d\  -f1 | rev` -O0 -Wall -Wextra -Wformat -pedantic -g -Isrc -Itmp -Itiny-AES-c # -fsanitize=address
MYLDFLAGS=-lresolv -lmd

default:
	mkdir -p tmp
	$(CC) $(MYCFLAGS) $(CFLAGS) src/main.c -otravnik $(MYLDFLAGS) $(LDFLAGS)

utils: tmp/midpoint tmp/bencoding tmp/dns tmp/info

tmp/%: utils/%.c src/dht.c
	$(CC) $(MYCFLAGS) $(CFLAGS) $< -o$@ $(MYLDFLAGS) $(LDFLAGS)

install:
	mkdir -p $(DESTDIR)/usr/bin/
	cp travnik $(DESTDIR)/usr/bin/

distclean: clean

clean:
	rm -rf travnik tmp test-eval

prepare:
	sudo apt install libmicrohttpd-dev build-essential default-libmysqlclient-dev -y

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

.PHONY: default install distclean clean prepare valgrind utils