📄 makefile
字号:
## Copyright (c) 2000 Blue Mug, Inc. All Rights Reserved.### Guarantee that the top-level TARGET variable, if set, is cs89712.#ifeq (,$(TARGET)) TARGET := cs89712endififneq (cs89712,$(TARGET)) error "building for cs89712 but TARGET != cs89712"endif## Configure settings based on the target passed from the top-level# makefile. The PROFILE := cdb89712 line is just a default and can# be overridden from the command line.#PROFILE := cdb89712ifneq (,$(wildcard profile-stamp)) last-profile := $(shell cat profile-stamp) ifneq ($(PROFILE),$(last-profile)) error := profile-error endifendififeq ($(PROFILE),cdb89712) SETTINGS := relocate standaloneendififeq ($(PROFILE),cdb89712-boot) SETTINGS := bootmode standaloneendififeq ($(PROFILE),cdb89712-kernel) SETTINGS := kernel standaloneendif## Configuration for standalone, optimized ARM7TDMI cross-compile.#CROSS := arm-linux-CC := $(CROSS)gccCFLAGS := -Wall -O2 -fomit-frame-pointer -I../../../include -nostdlib \ -mcpu=arm7tdmi -static## The LDSCRIPT variable can be overridden based on the target-derived# settings.#LDSCRIPT := flashOBJSECTIONS := .boot .text .data .bssOBJCOPYFLAGS := -O binary -S $(addprefix -j ,$(OBJSECTIONS))ASMS := boot.SSRCS := entry.c eth.c flash_intel.c frob.c gunzip.c \ linux.c loader.c medium.c memmap.c memzero.csetp = $(if $(findstring $(1),$(SETTINGS)),y)ifeq (y,$(call setp,bootmode)) ASMS := init.S CFLAGS += -DBOOTMODE LDSCRIPT := bootmodeendififeq (y,$(call setp,kernel)) ASMS := init.S LDSCRIPT := kernelendififeq (y,$(call setp,relocate)) CFLAGS += -DRELOCATEendififeq (y,$(call setp,standalone)) CFLAGS += -DSTANDALONEendifOBJS := $(SRCS:.c=.o)DEPS := $(SRCS:.c=.d)LIBS := -lgcc -ltargetall: $(error) profile-stamp loader-$(PROFILE).binprofile-error: @echo "previous PROFILE:" `cat profile-stamp` @echo "profile-stamp mismatch; 'make scrub' to switch profiles"; falseprofile-stamp: echo $(PROFILE) > $@# can be invoked from top-level Makefiledownload: shoehorn --terminal# Hermit second stage loader (ELF image)loader-$(PROFILE).elf: $(ASMS) $(OBJS) ../common/libtarget.a Makefile loader-$(PROFILE).lds $(CC) $(CFLAGS) -L. -L../common \ -Wl,-Map,loader-$(PROFILE).map \ -Wl,-Tloader-$(PROFILE).lds -o $@ \ $(ASMS) $(OBJS) \ -Wl,--start-group $(LIBS) -Wl,--end-grouploader-$(PROFILE).lds: $(wildcard loader.lds.*) cp loader.lds.$(LDSCRIPT) $@%.bin: %.elf $(CROSS)objcopy $(OBJCOPYFLAGS) $< $@# automated dependency checkingifeq (,$(filter clean scrub,$(MAKECMDGOALS)))include $(DEPS)DEPENDS := ../../../depend.sh%.d: %.c env CC=$(CC) $(DEPENDS) $< $@ $(CFLAGS)endif# installationPHONY: installinstall: $(INSTALL) -m 644 -o root -g root loader-$(PROFILE).bin \ $(INSTALLPREFIX)/lib/hermit/# housecleaning.PHONY: cleanclean: rm -f $(OBJS) loader-*.lds *.elf *.bin *.mapscrub: clean rm -f profile-stamp *.d
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -