Makefile 450 B

12345678910111213141516171819202122232425
  1. CC=gcc
  2. LD=ld
  3. CFLAGS=-O3 -D__USE_GNU=1 -std=gnu99
  4. CFLAGS_GDB=-DMALLOC_INJECTOR_BREAK_TO_GDB=1
  5. LDFLAGS=-lc -ldl
  6. SO_CFLAGS=-fpic
  7. SO_LDFLAGS=-shared
  8. TARGETS=malloc_fail.so malloc_fail_gdb.so
  9. all: $(TARGETS)
  10. %.so: %.o
  11. $(LD) $(SO_LDFLAGS) $(LDFLAGS) -o $@ $^
  12. malloc_fail.o: malloc_fail.c
  13. $(CC) $(SO_CFLAGS) $(CFLAGS) -c $^
  14. malloc_fail_gdb.o: malloc_fail.c
  15. $(CC) $(SO_CFLAGS) $(CFLAGS) $(CFLAGS_GDB) -o $@ -c $^
  16. clean:
  17. rm -f *.o
  18. rm -f $(TARGETS)