diff --git a/litex/soc/software/bios/Makefile b/litex/soc/software/bios/Makefile index 2771549d1..8a82c26e6 100755 --- a/litex/soc/software/bios/Makefile +++ b/litex/soc/software/bios/Makefile @@ -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 $@ diff --git a/litex/soc/software/demo/Makefile b/litex/soc/software/demo/Makefile index d58e35946..cb2d3e745 100644 --- a/litex/soc/software/demo/Makefile +++ b/litex/soc/software/demo/Makefile @@ -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