Advertisement
Raul_julian

makefile

Jan 25th, 2017
3,775
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #system vars
  2. CC = gcc
  3. CFLAGS = -Wall
  4. main = main.c
  5.  
  6. #loop elements
  7. DIRS := header class
  8. HEADERS := $(foreach dir,$(DIRS),$(wildcard $(dir)/*.h))
  9. CLASSES := $(foreach dir,$(DIRS),$(wildcard $(dir)/*.c))
  10.  
  11. #compile .c files
  12. main: $(CLASSES) $(OBJS)
  13.     $(CC) $(CFLAGS) $(main) $< -o $@
  14.     @echo "Compile with success!!"
  15.  
  16. #execute main file
  17. run:
  18.     ./main
  19.  
  20. #clear file
  21. clear:
  22.     rm main
  23.  
  24. start: main run clear
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement