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,--whole-archive \
|
||||||
-Wl,--gc-sections \
|
-Wl,--gc-sections \
|
||||||
-Wl,-Map,$@.map \
|
-Wl,-Map,$@.map \
|
||||||
$(LIBS:lib%=-l%) \
|
$(LIBS:lib%=-l%)
|
||||||
|
|
||||||
|
|
||||||
ifneq ($(OS),Windows_NT)
|
ifneq ($(OS),Windows_NT)
|
||||||
chmod -x $@
|
chmod -x $@
|
||||||
|
|
|
@ -3,40 +3,43 @@ BUILD_DIR?=../build/
|
||||||
include $(BUILD_DIR)/software/include/generated/variables.mak
|
include $(BUILD_DIR)/software/include/generated/variables.mak
|
||||||
include $(SOC_DIRECTORY)/software/common.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
|
ifdef WITH_CXX
|
||||||
OBJECTS += hellocpp.o
|
OBJECTS += hellocpp.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
all: demo.bin
|
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
|
# pull in dependency info for *existing* .o files
|
||||||
-include $(OBJECTS:.o=.d)
|
-include $(OBJECTS:.o=.d)
|
||||||
|
|
||||||
%.bin: %.elf
|
|
||||||
$(OBJCOPY) -O binary $< $@
|
|
||||||
chmod -x $@
|
|
||||||
|
|
||||||
demo.elf: $(OBJECTS)
|
|
||||||
$(CC) $(LDFLAGS) \
|
|
||||||
-T linker.ld \
|
|
||||||
-N -o $@ \
|
|
||||||
$(OBJECTS) \
|
|
||||||
$(PACKAGES:%=-L$(BUILD_DIR)/software/%) \
|
|
||||||
$(LIBS:lib%=-l%)
|
|
||||||
chmod -x $@
|
|
||||||
|
|
||||||
main.o: main.c
|
|
||||||
$(compile)
|
|
||||||
|
|
||||||
crt0.o: $(CPU_DIRECTORY)/crt0.S
|
|
||||||
$(assemble)
|
|
||||||
|
|
||||||
donut.o: CFLAGS += -w
|
donut.o: CFLAGS += -w
|
||||||
|
|
||||||
helloc.o: CFLAGS += -w
|
VPATH = $(BIOS_DIRECTORY):$(BIOS_DIRECTORY)/cmds:$(CPU_DIRECTORY)
|
||||||
|
|
||||||
hellocpp.o: CXXFLAGS += -w
|
|
||||||
|
|
||||||
%.o: %.cpp
|
%.o: %.cpp
|
||||||
$(compilexx)
|
$(compilexx)
|
||||||
|
@ -48,6 +51,6 @@ hellocpp.o: CXXFLAGS += -w
|
||||||
$(assemble)
|
$(assemble)
|
||||||
|
|
||||||
clean:
|
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