📄 makefile
字号:
## Copyright (c) 2003-2005 Atmark Techno, Inc. All Rights Reserved.### Guarantee that the top-level TARGET variable, if set, is armadilloj.#ifeq (, $(TARGET)) TARGET := armadillojendififeq (, $(PROFILE)) .PROFILE := ctypeelse .PROFILE := $(PROFILE)endifstatus :=error :=## Configure settings based on the target passed from the top-level# makefile. The PROFILE := armadilloj line is just a default and can# be overridden from the command line.#NCVT = ../../../tools/ncvtcurrent-profile := $(shell $(NCVT) $(TARGET) $(.PROFILE))ifneq (,$(wildcard profile-stamp)) previous-profile := $(shell cat profile-stamp) ifneq ($(current-profile), $(previous-profile)) error := profile-error endifendif## Configuration for Armadillo-J compiler, either stype or ctype#BUILD_NAME := $(shell $(NCVT) -c "-" loader $(TARGET) $(.PROFILE) v$(HERMIT_VERSION))BUILD_TARGETS := $(BUILD_NAME).binCROSS := arm-elf-GCC_VER := $(shell $(CROSS)gcc -dumpversion | sed "s/\..*//")INCLUDEDIR := ../../../includeCC := $(CROSS)gccCFLAGS := -Wall -O2 -fomit-frame-pointer \ -DHERMIT_VERSION='"$(HERMIT_VERSION)"' \ -nostdlib -mcpu=arm7tdmi -static \ -I$(INCLUDEDIR)CFLAGS += -DTARGET_PROFILE=\"$(current-profile)\"LDFLAGS := ## 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.S lib1funcs.S head.SSRCS := entry.c loader.c memmap.c linux.c bootmode.c medium_io.c \ memregions.c post.cSRCS += ../memzero.c ../medium.c ../frob.c ../gunzip.cSRCS += ../flash/flash_core.c ../flash/flash_amd.cifeq ($(GCC_VER), 2)SRCS += ../flash/flash_spi_dummy.c ../flash/flash_intel_dummy.cendif## Profile Specific#ifeq (ctype, $(.PROFILE)) CFLAGS += -DARMADILLOJ_CTYPE status := profile-detectendififeq (stype, $(.PROFILE)) CFLAGS += -DARMADILLOJ_STYPE status := profile-detectendififeq (stype-xk, $(.PROFILE)) CFLAGS += -DARMADILLOJ_STYPE status := profile-detect BYTESWAP := yendififeq (ctype-jig, $(.PROFILE)) SRCS += test.c CFLAGS += -DARMADILLOJ_CTYPE -DENABLE_JIG status := profile-detectendififeq (stype-jig, $(.PROFILE)) SRCS += test.c CFLAGS += -DARMADILLOJ_STYPE -DENABLE_JIG status := profile-detectendififeq (, $(error))ifeq (, $(status)) error := profile-unknownendifendifOBJS := $(SRCS:.c=.o)DEPS := $(SRCS:.c=.d)LIBS := -ltarget -lcall: $(error) profile-stamp $(BUILD_TARGETS)profile-error: @echo "profile-stamp mismatch; 'make scrub' to switch profiles" @echo " previous PROFILE:" $(previous-profile) @echo " current PROFILE:" $(current-profile) @falseprofile-unknown: @echo "unknown PROFILE: $(.PROFILE)" @falseprofile-stamp: @echo "$(current-profile)" > $@# Hermit second stage loader (ELF image)$(BUILD_NAME).elf: $(ASMS) $(OBJS) ../common/libtarget.a $(BUILD_NAME).lds $(CC) $(CFLAGS) -L. -L../common \ -Wl,-Map,$(BUILD_NAME).map \ -Wl,-T$(BUILD_NAME).lds -o $@ \ $(ASMS) $(OBJS) \ -Wl,--start-group $(LIBS) -Wl,--end-group$(BUILD_NAME).lds: loader.lds $(CPP) -P -x assembler-with-cpp $(CFLAGS) $< > $@%.bin: %.elf $(CROSS)objcopy $(OBJCOPYFLAGS) $< $@.pre if [ "$(BYTESWAP)" = "y" ]; then \ dd if=$@.pre of=$@ conv=swab ; \ else \ cp $@.pre $@ ; \ fi rm -f $@.pre# 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 \ $(BUILD_TARGETS) \ $(INSTALLPREFIX)/lib/hermit/# housecleaning.PHONY: cleanclean: rm -f $(OBJS) loader-*.lds *.elf *.bin *.mapscrub: clean rm -f profile-stamp rm -f *.d ../*.d ../flash/*.d rm -f *.o ../*.o ../flash/*.odistclean: scrub rm -f *~
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -