CFLAGS += -std=gnu17 -Wall -fPIC #-fPIE RANLIB ?= ranlib LIBS += -ldl -lc -lm LDFLAGS += -pie #LDFLAGS += -Wl,-I,$(HOME)/src/glibc/glibc-build/elf/ld-linux-x86-64.so.2 default: release #debug example: default example.elf example-%: % example.elf debug: CFLAGS += -g -Og -fsanitize=address debug: LDFLAGS += -g -Og -fsanitize=address debug: all release: CFLAGS += -O2 -flto -ffat-lto-objects release: LDFLAGS += -O2 -flto release: all all: libdynso.a libdynso.so dynso.o: dynso.c $(CC) -c -o "$@" $(CFLAGS) $^ libdynso.a: dynso.o $(AR) rcvs $@ $^ # $(RANLIB) $@ libdynso.so: dynso.o $(CC) -Wl,-soname=$@ -shared -o "$@" $^ $(CFLAGS) example.elf: dynso.c example.c $(CC) -o "$@" $^ $(CFLAGS) $(LDFLAGS) $(LIBS) -g -Og -fsanitize=address clean: $(RM) *.o *.so *.a example.elf .PHONY: clean default debug release all example example-debug example-release