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

                    

                                                                                                 
                                         
                                

                                            

                                          
                                                                                                                                                        











                                     
                                                                                                      






                                                                                                                                                  


                                                                                                                           

                                                                                     
DESTDIR=/
CC = cc
.NOTPARALLEL:
default:
	mkdir tmp -p
	sed "s/<!--ver-->/$$PVR/g" < src/hp.html > tmp/hp.html # gentoo ebuild. git overrides it.
	-VER=`git describe --always` && sed "s/<!--ver-->/$$VER/g" < src/hp.html > tmp/hp.html
	xxd -i < tmp/hp.html > tmp/hp.xxd
	echo ', 0' >> tmp/hp.xxd
	xxd -i < src/osdd.xml > tmp/osdd.xxd
	echo ', 0' >> tmp/osdd.xxd
	xxd -i < src/css.css > tmp/css.xxd
	echo ', 0' >> tmp/css.xxd
	$(CC) -Wall -Wextra -pedantic -Wno-unused-parameter -g -Isrc -Itmp -pthread src/main.c $$(xml2-config --libs --cflags) -lmicrohttpd -lm -osear.c

install:
	mkdir -p $(DESTDIR)/usr/bin/
	cp sear.c $(DESTDIR)/usr/bin/

distclean:
	rm sear.c tmp -rf

clean:
	rm sear.c tmp -rf

prepare:
	sudo apt install libmicrohttpd-dev xxd build-essential libxml2-dev php-cli debmake debheler -y

test-http:
	mkdir -p tmp
	gcc -Wall -pedantic -g -Isrc -Itmp test/nanohttp.c $$(xml2-config --libs --cflags) -otmp/nanohttp

test-http-valgrind:
	valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt tmp/nanohttp http://sijanec.eu/

valgrind:
	valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt ./sear.c

.PHONY: valgrind test-http-valgrind test-http prepare clean distclean install default