aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorjustanothercatgirl <sotov@twistea.su>2025-03-24 08:21:04 +0300
committerjustanothercatgirl <sotov@twistea.su>2025-03-24 08:21:04 +0300
commit787ef64ce61302a159ad48974272533b6fdf6c9e (patch)
tree94d1641a6b8d5e541ec1a9c6eafe9be15b3e4a91 /Makefile
initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files changed, 24 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..44869e6
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,24 @@
+# Makefile
+
+all: main endpoints.so
+
+.PHONY: all clean
+
+endpoints.o: endpoints.c
+ $(CC) -c $< -o $@
+
+rename.ld: endpoints.o
+ # Looks terrible
+ # All it does it generates renaming
+ echo SECTIONS { > $@
+ @readelf --syms endpoints.o | awk '/FUNC/ && /GLOBAL/ {printf "\t%s = %s;\n", gensub(/_/, "/", "g", $$8), $$8;}' >> $@
+ echo } >> $@
+
+endpoints.so: endpoints.o rename.ld
+ $(CC) -shared -Wl,rename.ld $< -fPIE -o $@
+
+main: main.c
+ $(CC) $< -ldl -lmicrohttpd -o $@
+
+clean:
+ $(RM) main endpoints.o endpoints.so rename.ld