Debian Codegraph @

ports/powerpc/Makefile

raw
1 include ../../py/mkenv.mk
2
3 # qstr definitions (must come before including py.mk)
4 QSTR_DEFS = qstrdefsport.h
5
6 # include py core make definitions
7 include $(TOP)/py/py.mk
8 include $(TOP)/extmod/extmod.mk
9
10 # potato or lpc_serial
11 UART ?= potato
12
13 ARCH = $(shell uname -m)
14 ifneq ("$(ARCH)", "ppc64")
15 ifneq ("$(ARCH)", "ppc64le")
16 CROSS_COMPILE ?= powerpc64le-linux-gnu-
17 endif
18 endif
19
20 INC += -I.
21 INC += -I$(TOP)
22 INC += -I$(BUILD)
23
24 CFLAGS += $(INC) -g -Wall -Wdouble-promotion -Wfloat-conversion -std=c99 $(COPT)
25 CFLAGS += -mno-string -mno-multiple -mno-vsx -mno-altivec -nostdlib
26 CFLAGS += -mlittle-endian -mstrict-align -msoft-float
27 CFLAGS += -Os
28 CFLAGS += -fdata-sections -ffunction-sections -fno-stack-protector -ffreestanding
29 CFLAGS += -U_FORTIFY_SOURCE
30
31 LDFLAGS += -N -T powerpc.lds -nostdlib
32
33 LIBS =
34
35 SRC_C = \
36 main.c \
37 uart_$(UART).c \
38 shared/libc/printf.c \
39 shared/libc/string0.c \
40 shared/readline/readline.c \
41 shared/runtime/pyexec.c \
42 shared/runtime/stdout_helpers.c \
43 $(BUILD)/_frozen_mpy.c \
44
45 SRC_QSTR += shared/readline/readline.c shared/runtime/pyexec.c
46
47 OBJ = $(PY_CORE_O)
48 OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
49 OBJ += $(BUILD)/head.o
50
51 all: $(BUILD)/firmware.elf $(BUILD)/firmware.map $(BUILD)/firmware.bin
52
53 $(BUILD)/_frozen_mpy.c: $(TOP)/tests/frozen/frozentest.mpy $(BUILD)/genhdr/qstrdefs.generated.h
54 $(ECHO) "MISC freezing bytecode"
55 $(Q)$(MPY_TOOL) -f -q $(BUILD)/genhdr/qstrdefs.preprocessed.h -mlongint-impl=mpz $< > $@
56
57 $(BUILD)/firmware.elf: $(OBJ) powerpc.lds
58 $(ECHO) "LINK $@"
59 $(Q)$(LD) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
60 $(Q)$(SIZE) $@
61
62 $(BUILD)/firmware.bin: $(BUILD)/firmware.elf
63 $(Q)$(OBJCOPY) -O binary $^ $(BUILD)/firmware.bin
64
65 $(BUILD)/firmware.map: $(BUILD)/firmware.elf
66 $(Q)nm $^ | sort > $(BUILD)/firmware.map
67
68 include $(TOP)/py/mkrules.mk