Advertisement
Guest User

Makefile

a guest
May 13th, 2014
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 1.28 KB | None | 0 0
  1. #put makefile in main project directory
  2.  
  3. SRC_FILES = $(wildcard ./src/*.cpp ./src/*.hpp)
  4. INC_DIRS = -I"./src" -I"$(HOME)/codes"
  5. LIB_FLAGS =
  6. LIB_DIRS =
  7. GCC_FLAGS= -Wall -O2
  8.  
  9. #generate list of all dependencies of the project
  10. DEP_LIST1 = $(shell g++ -M $(SRC_FILES) $(INC_DIRS))
  11. #filter out the main.o: etc parts
  12. DEP_LIST2 = $(filter-out %.o:, $(DEP_LIST1))
  13. #filter out the \ newline character caused by taking bash output
  14. DEP_LIST3 = $(filter-out \, $(DEP_LIST2))
  15. #strip whitespace
  16. DEP_LIST = $(strip $(DEP_LIST3))
  17.  
  18. #suppress some ctags kinds, turn on recursion
  19. # kinds options for C++:
  20. #    c  classes
  21. #    d  macro definitions
  22. #    e  enumerators (values inside an enumeration)
  23. #    f  function definitions
  24. #    g  enumeration names
  25. #    l  local variables [off]
  26. #    m  class, struct, and union members
  27. #    n  namespaces
  28. #    p  function prototypes [off]
  29. #    s  structure names
  30. #    t  typedefs
  31. #    u  union names
  32. #    v  variable definitions
  33. #    x  external and forward variable declarations [off]
  34.  
  35. CTAGS_OPTIONS = --C++-kinds=-d --C++-kinds=-e --C++-kinds=-m \
  36. --C++-kinds=-u --C++-kinds=-v
  37.  
  38.  
  39.  
  40. default: compile
  41.  
  42. compile:    
  43.     g++ $(SRC_FILES) $(INC_DIRS) $(LIB_DIRS) $(GCC_FLAGS) -o ./bin/n.o $(LIB_FLAGS)
  44.  
  45.  
  46. taggen:
  47.     @ctags $(CTAGS_OPTIONS) $(DEP_LIST)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement