Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. CC ?= gcc
  2. CFLAGS ?= -pipe -Wall -Werror
  3. CLIBS ?= -lpthread
  4.  
  5. TARGET ?= main
  6. SRC := $(wildcard *.c)
  7. OBJ := $(patsubst %.c,%.o,$(SRC))
  8.  
  9.  
  10. .PHONY: all debug release clean clean-objs
  11. .DEFAULT_GOAL := release
  12.  
  13.  
  14. debug: CFLAGS += -O0 -ggdb3
  15. debug: $(TARGET) clean-objs
  16.  
  17. release: CFLAGS += -O3
  18. release: $(TARGET) clean-objs
  19.  
  20. $(TARGET): $(OBJ)
  21. $(CC) $(OBJ) -o $(TARGET) $(CLIBS)
  22.  
  23. %.o: %.c
  24. $(CC) $(CFLAGS) $(CLIBS) -c $< -o $@
  25.  
  26. clean: clean-objs
  27. @rm $(TARGET)
  28.  
  29. clean-objs:
  30. @rm -f *.o
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement