pxt-ev3/libs/core/Makefile

42 lines
1.1 KiB
Makefile
Raw Normal View History

2017-06-29 17:35:57 +02:00
include Makefile.inc
2017-07-01 13:05:52 +02:00
COMMON_FLAGS = -W -Wall -Wno-unused-parameter -Ipxtapp -fwrapv -fno-threadsafe-statics -Os -mthumb $(NPM_INCLUDES)
2017-06-29 17:35:57 +02:00
CFLAGS = $(COMMON_FLAGS) -std=c99
CXXFLAGS = $(COMMON_FLAGS) -std=c++11 -fno-rtti -fno-exceptions -fno-unwind-tables
LDFLAGS = -Wl,--gc-sections -Wl,--sort-common -Wl,--sort-section=alignment
2017-06-30 13:10:08 +02:00
PREF = arm-linux-gnueabi-
CC = $(PREF)gcc
LD = $(PREF)gcc
LIBSTDCPP = /usr/lib/gcc/arm-linux-gnueabi/4.9/libstdc++.a
2017-07-01 13:05:52 +02:00
NPM_LIBS = $(wildcard node_modules/*/lib/*.a)
NPM_INCLUDES = $(addprefix -I, $(wildcard node_modules/*/include))
2017-06-29 17:35:57 +02:00
EXE = bld/pxt-app.elf
2017-07-01 12:43:10 +02:00
HEX = $(EXE:.elf=.hex)
2017-06-29 17:35:57 +02:00
DEPS = $(PXT_HEADERS) package.json Makefile Makefile.inc
all: $(EXE)
$(EXE): $(PXT_OBJS)
2017-07-01 13:05:52 +02:00
$(LD) -o $(EXE) $(LDFLAGS) -Wl,-Map,$(EXE:.elf=.map) $(PXT_OBJS) $(LIBSTDCPP) -lm $(NPM_LIBS)
2017-06-30 13:10:08 +02:00
cp $(EXE) $(EXE:.elf=.full)
$(PREF)strip $(EXE)
2017-07-01 12:43:10 +02:00
node -p 'require("fs").readFileSync("$(EXE)").toString("hex")' > $(HEX)
2017-06-30 13:10:08 +02:00
@ls -l $(EXE)
2017-06-29 17:35:57 +02:00
clean:
rm -rf bld
bld/%.o: %.cpp $(DEPS)
@mkdir -p $(dir $@)
$(CC) $(CXXFLAGS) -c $< -o $@
bld/%.o: %.s $(DEPS)
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
bld/%.o: %.c $(DEPS)
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@