⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rules.make

📁 MAKEFILE 经典编写方法
💻 MAKE
字号:
##  Rules.make#  the rules for making any sample project##  Bugs Report:  li ming (lmcs00@mails.tsinghua.edu.cn)#  Release:      2003-02-13 19:10:25#	# for building this project both on linux or cygwinCROSS_COMPILE = # define rule for making .depend ifneq (.depend, $(wildcard .depend))depend: dep	@echo "Help: you can use use \"make dep\" to create .depend"		endif# define some compiler namesCC		= $(CROSS_COMPILE)gccAS		= $(CROSS_COMPILE)gccAR		= $(CROSS_COMPILE)arLD		= $(CROSS_COMPILE)ld	NM		= $(CROSS_COMPILE)nmOBJDUMP		= $(CROSS_COMPILE)objdumpREADELF		= $(CROSS_COMPILE)readelfRM		= rm -fRN		= mvBIN		= $(CROSS_COMPILE)objcopyCCDEP		= $(CROSS_COMPILE)gcc# define the default rule for building any sample testall: 	$(PRJ_NAME).elf	@echo "Hint: now you can \"make test\" to debug $(PRJ_NAME).elf"test: 	./$(PRJ_NAME).elf 	# put include .depend here to make "all" at the first place! ifeq (.depend, $(wildcard .depend))	include .dependendif# define rules for build *.c & *.S files%.o:	@echo + compiling c file with .depend ... : $< 		@echo $(CC) -c $(CPFLAGS) $(INCDIR) $(<:.o=.c)	@$(CC) -c $(CPFLAGS) $(INCDIR) $(<:.o=.c)	@echo	config: 	@echo -n "building target platform is " 	@if test $(OSTYPE) = cygwin ;	then \		echo "on cgywin!"; \		echo CROSS_COMPILE = arm-linux- > $(CFG_FILE); \		echo LIBPATH = -L/lib/gcc-lib/arm-linux/2.95.3/ -L/usr/arm-linux/lib >> $(CFG_FILE); \	elif test $(OSTYPE) = linux-gnu ; then \		echo "on linux!"; \		echo CROSS_COMPILE = arm-elf- > $(CFG_FILE); \		echo LIBPATH = -L/usr/local/lib/gcc-lib/arm-elf/2.95.3/ >> $(CFG_FILE); \	else \		echo " ???" ; \		echo " ------------------------------------------  " ; \		echo " I can not guess the host operation system" ; \		echo " please set OSTYPE variable in rules.make !" ; \		echo " or execute command export OSTYPE=linux-gnu " ; \		echo " in bash shell, if your host system is linux." ; \		echo " or execute commands export OSTYPE=cygwin " ; \		echo " in cygwin bash shell, if your host system is cgwin." ; \		echo " Then you should try make config again!" ; \		echo " ------------------------------------------  " ; \	fi ; 	@echo "creating cross-compiler config file: $(CFG_FILE) ... "	@echo "Hint: next, you can \"make \" this project now..."	dep:	$(START_FILE) $(OBJS_FILES)	@echo + making dep file ... : .depend	@$(CCDEP) $(CFLAGS) $(INCDIR) -MM $^ > .depend || rm -f .depend	@echo "Hint: next, you can \"make\" this project now..."$(PRJ_NAME).elf: .depend $(DEP_FILES) $(START_OBJ) $(OBJS) 	@echo + linking o file ... : $(START_OBJ) $(OBJS) "->" $(PRJ_NAME).elf	$(CC) $(OBJS) -o $(PRJ_NAME).elf	@echo $(OBJDUMP) -S $(PRJ_NAME).elf ">" $(PRJ_NAME).s	@$(OBJDUMP) -S $(PRJ_NAME).elf > $(PRJ_NAME).s	@echo $(READELF) -a $(PRJ_NAME).elf ">" $(PRJ_NAME).r	@$(READELF) -a $(PRJ_NAME).elf > $(PRJ_NAME).r	@echo $(NM)	$(PRJ_NAME).elf ">" $(PRJ_NAME).n	@$(NM)	$(PRJ_NAME).elf > $(PRJ_NAME).n	@echoclean:				rm -f *.stackdump		rm -f $(PRJ_NAME).elf		rm -f $(PRJ_NAME).s		rm -f $(PRJ_NAME).r		rm -f $(PRJ_NAME).n		rm -f $(START_OBJ)		rm -f $(OBJS)		cleanall:	clean				rm -f $(CFG_FILE)		rm -f *.bak		rm -f .depend	t:		echo ahah

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -