Advertisement
oOBATOo

Untitled

Sep 6th, 2022
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. ########################################################################
  2. ####################### Makefile Template ##############################
  3. ########################################################################
  4.  
  5. # Compiler settings - Can be customized.
  6. CC = g++
  7. CXXFLAGS = -std=c++11 -Wall
  8. LDFLAGS =
  9.  
  10. # Makefile settings - Can be customized.
  11. APPNAME = FilePicker
  12. EXT = .cpp
  13. SRCDIR = /home/steve/Projects/FilePicker/
  14. OBJDIR = obj
  15.  
  16. ############## Do not change anything from here downwards! #############
  17. SRC = $(wildcard $(SRCDIR)/*$(EXT))
  18. OBJ = $(SRC:$(SRCDIR)/%$(EXT)=$(OBJDIR)/%.o)
  19. DEP = $(OBJ:$(OBJDIR)/%.o=%.d)
  20. # UNIX-based OS variables & settings
  21. RM = rm
  22. DELOBJ = $(OBJ)
  23. # Windows OS variables & settings
  24. DEL = del
  25. EXE = .exe
  26. WDELOBJ = $(SRC:$(SRCDIR)/%$(EXT)=$(OBJDIR)\\%.o)
  27.  
  28. ########################################################################
  29. ####################### Targets beginning here #########################
  30. ########################################################################
  31.  
  32. all: $(APPNAME)
  33.  
  34. # Builds the app
  35. $(APPNAME): $(OBJ)
  36. $(CC) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
  37.  
  38. # Creates the dependecy rules
  39. %.d: $(SRCDIR)/%$(EXT)
  40. @$(CPP) $(CFLAGS) $< -MM -MT $(@:%.d=$(OBJDIR)/%.o) >$@
  41.  
  42. # Includes all .h files
  43. -include $(DEP)
  44.  
  45. # Building rule for .o files and its .c/.cpp in combination with all .h
  46. $(OBJDIR)/%.o: $(SRCDIR)/%$(EXT)
  47. $(CC) $(CXXFLAGS) -o $@ -c $<
  48.  
  49. ################### Cleaning rules for Unix-based OS ###################
  50. # Cleans complete project
  51. .PHONY: clean
  52. clean:
  53. $(RM) $(DELOBJ) $(DEP) $(APPNAME)
  54.  
  55. # Cleans only all files with the extension .d
  56. .PHONY: cleandep
  57. cleandep:
  58. $(RM) $(DEP)
  59.  
  60. #################### Cleaning rules for Windows OS #####################
  61. # Cleans complete project
  62. .PHONY: cleanw
  63. cleanw:
  64. $(DEL) $(WDELOBJ) $(DEP) $(APPNAME)$(EXE)
  65.  
  66. # Cleans only all files with the extension .d
  67. .PHONY: cleandepw
  68. cleandepw:
  69. $(DEL) $(DEP)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement