Chinaunix首页 | 论坛 | 博客
  • 博客访问: 963584
  • 博文数量: 109
  • 博客积分: 554
  • 博客等级: 中士
  • 技术积分: 2577
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-04 12:49
文章分类

全部博文(109)

文章存档

2019年(5)

2016年(7)

2015年(9)

2014年(1)

2013年(71)

2012年(16)

分类: 嵌入式

2013-05-18 14:18:39


  1. ###########################################################
  2. # Generic makefile 
  3. # 
  4. # by George Foot 
  5. # email: george.foot@merton.ox.ac.uk 
  6. # 
  7. # Copyright (c) 1997 George Foot 
  8. # All rights reserved. 
  9. # 保留所有版權 
  10. # 
  11. # No warranty, no liability; 
  12. # you use this at your own risk. 
  13. # 沒保險,不負責 
  14. # 你要用這個,你自己擔風險 
  15. # 
  16. # You are free to modify and 
  17. # distribute this without giving 
  18. # credit to the original author. 
  19. # 你可以隨便更改和散發這個文件 
  20. # 而不需要給原作者什榮譽。 
  21. # (你好意思?) 
  22. # 
  23. ######################################
  24. ### Customising
  25. #
  26. # Adjust the following if necessary; EXECUTABLE is the target
  27. # executable's filename, and LIBS is a list of libraries to link in
  28. # (e.g. alleg, stdcx, iostr, etc). You can override these on make's
  29. # command line of course, if you prefer to do it that way.
  30. # 
  31. # 如果需要,調整下面的東西。 EXECUTABLE 是目標的可執行文件名, LIBS
  32. # 是一個需要連接的程序包列表(例如 alleg, stdcx, iostr 等等)。當然你
  33. # 可以在 make 的命令行覆蓋它們,你願意就沒問題。
  34. # 
  35. EXECUTABLE := mushroom.exe
  36. LIBS := alleg
  37. # Now alter any implicit rules' variables if you like, e.g.:
  38. #
  39. # 現在來改變任何你想改動的隱含規則中的變量,例如
  40. CFLAGS := -g -Wall -O3 -m486
  41. CXXFLAGS := $(CFLAGS)
  42. # The next bit checks to see whether rm is in your djgpp bin
  43. # directory; if not it uses del instead, but this can cause (harmless)
  44. # `File not found' error messages. If you are not using DOS at all,
  45. # set the variable to something which will unquestioningly remove
  46. # files.
  47. #
  48. # 下面先檢查你的 djgpp 命令目錄下有沒有 rm 命令,如果沒有,我們使用
  49. # del 命令來代替,但有可能給我們 'File not found' 這個錯誤信息,這沒
  50. # 什大礙。如果你不是用 DOS ,把它設定成一個刪文件而不廢話的命令。
  51. # (其實這一步在 UNIX 類的系統上是多余的,只是方便 DOS 用戶。 UNIX
  52. # 用戶可以刪除這5行命令。)
  53. ifneq ($(wildcard $(DJDIR)/bin/rm.exe),)
  54. RM-F := rm -f
  55. else
  56. RM-F := del
  57. endif
  58. # You shouldn't need to change anything below this point.
  59. #
  60. # 從這裡開始,你應該不需要改動任何東西。(我是不太相信,太NB了!)
  61. SOURCE := $(wildcard *.c) $(wildcard *.cc)
  62. OBJS := $(patsubst %.c,%.o,$(patsubst %.cc,%.o,$(SOURCE)))
  63. DEPS := $(patsubst %.o,%.d,$(OBJS))
  64. MISSING_DEPS := $(filter-out $(wildcard $(DEPS)),$(DEPS))
  65. MISSING_DEPS_SOURCES := $(wildcard $(patsubst %.d,%.c,$(MISSING_DEPS)) 
  66. $(patsubst %.d,%.cc,$(MISSING_DEPS)))
  67. CPPFLAGS += -MD
  68. .PHONY : everything deps objs clean veryclean rebuild
  69. everything : $(EXECUTABLE)
  70. deps : $(DEPS)
  71. objs : $(OBJS)
  72. clean :
  73.   @$(RM-F) *.o
  74.   @$(RM-F) *.d
  75. veryclean: clean
  76.   @$(RM-F) $(EXECUTABLE)
  77. rebuild: veryclean everything
  78. ifneq ($(MISSING_DEPS),)
  79. $(MISSING_DEPS) :
  80.   @$(RM-F) $(patsubst %.d,%.o,$@)
  81. endif
  82. -include $(DEPS)
  83. $(EXECUTABLE) : $(OBJS)
  84.   gcc -o $(EXECUTABLE) $(OBJS) $(addprefix -l,$(LIBS))
  85. ###


阅读(605) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~