-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
55 lines (39 loc) · 1.09 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
BUILD_DIR=../../build/sipeed_tang_nano_9k
SOC_DIR=/usr/local/share/litex/litex/litex/litex/soc/
#SOC_DIR=/home/rik/Documents/Git/litex/litex/litex/soc/
include $(BUILD_DIR)/software/include/generated/variables.mak
include $(SOC_DIR)/software/common.mak
OBJ_DIR=build
OBJECTS = $(OBJ_DIR)/crt0.o
OBJECTS += $(patsubst %.c,%.o,$(wildcard *.c */*.c */*/*.c))
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_mainram.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)
VPATH = $(BIOS_DIRECTORY):$(BIOS_DIRECTORY)/cmds:$(CPU_DIRECTORY)
$(OBJ_DIR)/%.o: %.cpp
$(compilexx)
$(OBJ_DIR)/%.o: %.c
$(compile)
$(OBJ_DIR)/%.o: %.S
$(assemble)
@echo $(OBJECTS)
clean:
$(RM) $(OBJECTS) $(OBJECTS:.o=.d) demo.elf demo.bin .*~ *~ *.d
.PHONY: all clean