# Makefile CFLAGS += -Ic_headers/include all: main endpoints.so .PHONY: all clean endpoints.o: endpoints.c $(CC) -c $< $(CFLAGS) -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) $< $(CFLAGS) -ldl -lmicrohttpd -o $@ clean: $(RM) main endpoints.o endpoints.so rename.ld