makefile

来自「一个基于MMU的操作系统」· 代码 · 共 41 行

TXT
41
字号

ASM_FILES	:= 

C_FILES 	:= main.c

SUBDIRS	:= 

DEPFILES 	:= $(patsubst %.S,%.d,$(ASM_FILES)) $(patsubst %.c,%.d,$(C_FILES))

OBJFILES 	:= $(patsubst %.S,%.o,$(ASM_FILES)) $(patsubst %.c,%.o,$(C_FILES)) $(patsubst %/,%/built-in.o,$(SUBDIRS))


built-in.o : $(OBJFILES) $(patsubst %/,%/built-in.o,$(SUBDIRS))
	$(LD) $(LDFLAGS) -r -o $@ $(OBJFILES) $(patsubst %/,%/built-in.o,$(SUBDIRS))

$(patsubst %/,%/built-in.o,$(SUBDIRS)): FORCE
	for i in $(SUBDIRS); do \
		cd $$i; $(MAKE); cd ..; \
		done

FORCE :;


dep : $(DEPFILES)
	for i in $(SUBDIRS); do \
		cd $$i; $(MAKE) dep; cd ..; \
		done


clean:
	rm -f built-in.o $(OBJFILES) $(DEPFILES)


HAS_DEP	:= $(foreach file, $(DEPFILES), $(shell \
				if test -f $(file); then echo 'Y';\
				 else  echo 'N'; fi))
ifeq ($(findstring N, $(HAS_DEP)),)
include $(DEPFILES)
endif

include $(TOPDIR)/Rules.make

⌨️ 快捷键说明

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