software/demo/Makefile: Make it as much as possible similar to BIOS's Makefile.
This commit is contained in:
parent
b9fce9e1b2
commit
8e1265113b
|
@ -72,8 +72,7 @@ vpath %.a $(PACKAGES:%=../%)
|
|||
-Wl,--whole-archive \
|
||||
-Wl,--gc-sections \
|
||||
-Wl,-Map,$@.map \
|
||||
$(LIBS:lib%=-l%) \
|
||||
|
||||
$(LIBS:lib%=-l%)
|
||||
|
||||
ifneq ($(OS),Windows_NT)
|
||||
chmod -x $@
|
||||
|
|
|
@ -3,40 +3,43 @@ BUILD_DIR?=../build/
|
|||
include $(BUILD_DIR)/software/include/generated/variables.mak
|
||||
include $(SOC_DIRECTORY)/software/common.mak
|
||||
|
||||
OBJECTS = donut.o helloc.o main.o crt0.o
|
||||
OBJECTS = donut.o helloc.o crt0.o main.o
|
||||
ifdef WITH_CXX
|
||||
OBJECTS += hellocpp.o
|
||||
endif
|
||||
|
||||
|
||||
all: demo.bin
|
||||
|
||||
|
||||
%.bin: %.elf
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
ifneq ($(OS),Windows_NT)
|
||||
chmod -x $@
|
||||
endif
|
||||
|
||||
vpath %.a $(PACKAGES:%=../%)
|
||||
|
||||
demo.elf: $(OBJECTS)
|
||||
$(CC) $(LDFLAGS) -T linker.ld -N -o $@ \
|
||||
$(OBJECTS) \
|
||||
$(PACKAGES:%=-L$(BUILD_DIR)/software/%) \
|
||||
-Wl,--whole-archive \
|
||||
-Wl,--gc-sections \
|
||||
-Wl,-Map,$@.map \
|
||||
$(LIBS:lib%=-l%)
|
||||
|
||||
ifneq ($(OS),Windows_NT)
|
||||
chmod -x $@
|
||||
endif
|
||||
|
||||
# pull in dependency info for *existing* .o files
|
||||
-include $(OBJECTS:.o=.d)
|
||||
|
||||
%.bin: %.elf
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
chmod -x $@
|
||||
donut.o: CFLAGS += -w
|
||||
|
||||
demo.elf: $(OBJECTS)
|
||||
$(CC) $(LDFLAGS) \
|
||||
-T linker.ld \
|
||||
-N -o $@ \
|
||||
$(OBJECTS) \
|
||||
$(PACKAGES:%=-L$(BUILD_DIR)/software/%) \
|
||||
$(LIBS:lib%=-l%)
|
||||
chmod -x $@
|
||||
VPATH = $(BIOS_DIRECTORY):$(BIOS_DIRECTORY)/cmds:$(CPU_DIRECTORY)
|
||||
|
||||
main.o: main.c
|
||||
$(compile)
|
||||
|
||||
crt0.o: $(CPU_DIRECTORY)/crt0.S
|
||||
$(assemble)
|
||||
|
||||
donut.o: CFLAGS += -w
|
||||
|
||||
helloc.o: CFLAGS += -w
|
||||
|
||||
hellocpp.o: CXXFLAGS += -w
|
||||
|
||||
%.o: %.cpp
|
||||
$(compilexx)
|
||||
|
@ -48,6 +51,6 @@ hellocpp.o: CXXFLAGS += -w
|
|||
$(assemble)
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJECTS) $(OBJECTS:.o=.d) demo.elf demo.bin .*~ *~
|
||||
$(RM) $(OBJECTS) demo.elf demo.bin .*~ *~
|
||||
|
||||
.PHONY: all main.o clean load
|
||||
.PHONY: all clean
|
||||
|
|
Loading…
Reference in New Issue