Advertisement
Io-EE

Makefile (memo)

Aug 8th, 2011
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. CPP=g++
  2. CFLAGS=-Wall
  3. SRC=main.cpp foo.h
  4. OBJ=$(SRC:.cpp=.o)
  5.  
  6. all: foo
  7. #$@ Le nom de la cible
  8. #$< Le nom de la première dépendance
  9. #$^ La liste des dépendances
  10. #$? La liste des dépendances plus récentes que la cible
  11. #$* Le nom du fichier sans suffixe
  12. foo: $(OBJ)
  13. @$(CPP) $(CFLAGS) $^ -o $@
  14.  
  15. main.o: foo.h
  16.  
  17. %.o: %.cpp
  18. @$(CPP) $(CFLAGS) -c $< -o $@
  19.  
  20. .PHONY: clean
  21.  
  22. clean:
  23. @rm *.o
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement