Makefile 709 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. TARGET:= termyt
  2. CC:= gcc
  3. CFLAGS:= -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wall -Wextra -fPIE -Iinclude/
  4. LDFLAGS:= -Wl,-z,relro,-z,now,-pie
  5. LDLIBS:= -lssl -lcrypto -lreadline
  6. OBJS:= main.o menu.o network.o parse.o youtube.o
  7. # Debug?
  8. D ?= 1
  9. ifeq ($(D),1)
  10. CFLAGS += -DDEBUG -ggdb
  11. else
  12. CFLAGS += -DNDEBUG -O2
  13. LDFLAGS += -s
  14. endif
  15. all: $(TARGET)
  16. $(TARGET): $(OBJS)
  17. @echo " CC $@"
  18. @$(CC) $(CFLAGS) $(OBJS) -o $@ $(LDLIBS) $(LDFLAGS)
  19. help:
  20. @echo "Usage: make [target]"
  21. @echo ""
  22. @echo "Targets:"
  23. @echo " termyt - Build termyt"
  24. @echo " clean - Remove generated files"
  25. %.o: %.c
  26. @echo " CC $@"
  27. @$(CC) $(CFLAGS) -c -o $@ $<
  28. clean:
  29. $(RM) $(TARGET)
  30. $(RM) $(OBJS)
  31. .PHONY: clean all help