summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-04-24 13:24:41 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2022-04-24 13:24:41 +0200
commitfc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6 (patch)
tree06b2206059672a98ce7797e3e7359f5801e2f0b7 /Makefile
parentseparated css and html, removed php-cli dependency (diff)
downloadsear.c-fc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6.tar
sear.c-fc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6.tar.gz
sear.c-fc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6.tar.bz2
sear.c-fc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6.tar.lz
sear.c-fc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6.tar.xz
sear.c-fc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6.tar.zst
sear.c-fc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6.zip
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 12 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index a8baf36..f72022e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,21 +1,30 @@
DESTDIR=/
CC = cc
+cflags = -O0 -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-trampolines -g -Isrc -Itmp -pthread
+SRCFILE = src/main.c
+ldflags = $(shell xml2-config --libs --cflags) -lmicrohttpd -lm
+BINFILE = sear.c
+# 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:
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
+ sed -i "s/=&gt;/$(shell echo '#include "src/i18n.h"' | $(CC) -dM -E - | grep "SC_I18N_SEARCH " | cut -d' ' -f3)/g" tmp/hp.html
+ sed -i "s/1\./$(shell echo '#include "src/i18n.h"' | $(CC) -dM -E - | grep "SC_I18N_HORSESHOE " | cut -d' ' -f3)/g" tmp/hp.html
+ sed -i "s/\[^\]/$(shell echo '#include "src/i18n.h"' | $(CC) -dM -E - | grep "SC_I18N_IMAGES " | cut -d' ' -f3)/g" 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
+ $(CC) $(cflags) $(CFLAGS) $(SRCFILE) $(ldflags) $(LDFLAGS) -o$(BINFILE)
install:
mkdir -p $(DESTDIR)/usr/bin/
- cp sear.c $(DESTDIR)/usr/bin/
+ cp $(BINFILE) $(DESTDIR)/usr/bin/
distclean:
rm sear.c tmp -rf
@@ -24,7 +33,7 @@ clean:
rm sear.c tmp -rf
prepare:
- sudo apt install libmicrohttpd-dev xxd build-essential libxml2-dev php-cli debmake debheler -y
+ apt install libmicrohttpd-dev xxd build-essential libxml2-dev php-cli debmake debheler -y
test-http:
mkdir -p tmp