Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. ######################################
  2. #
  3. # Generic makefile
  4. #
  5. # by George Foot
  6. # email: george.foot@merton.ox.ac.uk
  7. #
  8. # Copyright (c) 1997 George Foot
  9. # All rights reserved.
  10. # 保留所有版权
  11. #
  12. # No warranty, no liability;
  13. # you use this at your own risk.
  14. # 没保险,不负责
  15. # 你要用这个,你自己担风险
  16. #
  17. # You are free to modify and
  18. # distribute this without giving
  19. # credit to the original author.
  20. # 你可以随便更改和散发这个文件
  21. # 而不需要给原作者什么荣誉。
  22. # (你好意思?)
  23. #
  24. ######################################
  25.  
  26. ### Customising
  27. # 用户设定
  28. #
  29. # Adjust the following if necessary; EXECUTABLE is the target
  30. # executable's filename, and LIBS is a list of libraries to link in
  31. # (e.g. alleg, stdcx, iostr, etc). You can override these on make's
  32. # command line of course, if you prefer to do it that way.
  33. #
  34. # 如果需要,调整下面的东西。 EXECUTABLE 是目标的可执行文件名, LIBS
  35. # 是一个需要连接的程序包列表(例如 alleg, stdcx, iostr 等等)。当然你
  36. # 可以在 make 的命令行覆盖它们,你愿意就没问题。
  37. #
  38.  
  39. EXECUTABLE := set_test.exe
  40. #LIBS := alleg
  41.  
  42. # Now alter any implicit rules' variables if you like, e.g.:
  43. #
  44. # 现在来改变任何你想改动的隐含规则中的变量,例如
  45. CC = gcc
  46. CFLAGS := -Wall -O -g
  47. CXXFLAGS := $(CFLAGS)
  48.  
  49. # The next bit checks to see whether rm is in your djgpp bin
  50. # directory; if not it uses del instead, but this can cause (harmless)
  51. # `File not found' error messages. If you are not using DOS at all,
  52. # set the variable to something which will unquestioningly remove
  53. # files.
  54. #
  55. # 下面先检查你的 djgpp 命令目录下有没有 rm 命令,如果没有,我们使用
  56. # del 命令来代替,但有可能给我们 'File not found' 这个错误信息,这没
  57. # 什么大碍。如果你不是用 DOS ,把它设定成一个删文件而不废话的命令。
  58. # (其实这一步在 UNIX 类的系统上是多余的,只是方便 DOS 用户。 UNIX
  59. # 用户可以删除这5行命令。)
  60. #ifneq ($(wildcard $(DJDIR)/bin/rm.exe),)
  61. #RM-F := rm -f
  62. #else
  63. #RM-F := del
  64. #endif
  65. RM_F := rm -f
  66.  
  67. # You shouldn't need to change anything below this point.
  68. #
  69. # 从这里开始,你应该不需要改动任何东西。(我是不太相信,太NB了!)
  70.  
  71. SOURCE := $(wildcard *.c) $(wildcard *.cc)
  72. OBJS := $(patsubst %.c,%.o,$(patsubst %.cc,%.o,$(SOURCE)))
  73. DEPS := $(patsubst %.o,%.d,$(OBJS))
  74. MISSING_DEPS := $(filter-out $(wildcard $(DEPS)),$(DEPS))
  75. MISSING_DEPS_SOURCES := $(wildcard $(patsubst %.d,%.c,$(MISSING_DEPS)) \
  76. $(patsubst %.d,%.cc,$(MISSING_DEPS)))
  77. CPPFLAGS += -MD
  78.  
  79. .PHONY : everything deps objs clean veryclean rebuild
  80.  
  81. everything : $(EXECUTABLE)
  82.  
  83. deps : $(DEPS)
  84.  
  85. objs : $(OBJS)
  86.  
  87. clean :
  88. @$(RM-F) *.o
  89. @$(RM-F) *.d
  90.  
  91. veryclean: clean
  92. @$(RM-F) $(EXECUTABLE)
  93.  
  94. rebuild: veryclean everything
  95.  
  96. ifneq ($(MISSING_DEPS),)
  97. $(MISSING_DEPS) :
  98. @$(RM-F) $(patsubst %.d,%.o,$@)
  99. endif
  100.  
  101. -include $(DEPS)
  102.  
  103. $(EXECUTABLE) : $(OBJS)
  104. gcc -o $(EXECUTABLE) $(OBJS) $(addprefix -l,$(LIBS))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement