Source

pebble / Makefile.pebble

Full commit
#
# Makefile for Pebble watch projects.
#
# The makefile should define:
# 	SRCS with a list of source files.
#	TARGET := project to build
#
PEBBLE_HOME := $(HOME)/build/pebble/sdk
PYTHON := python

GCC_PREFIX := $(HOME)/arm-cs-tools/bin/arm-none-eabi-

CC := $(GCC_PREFIX)gcc
LD := $(CC)
OBJCOPY := $(GCC_PREFIX)objcopy


CFLAGS += \
	-std=c99 \
	-g \
	-O0 \
	-Wall \
	-Wextra \
	-Wno-error=unused-function \
	-Wno-error=unused-variable \
	-Wno-error=unused-parameter \
	-fPIE \
	-I$(PEBBLE_HOME)/include \
	-I. \
	-I.. \
	-DNDEBUG \

LDFLAGS += \
	-mcpu=cortex-m3	\
	-mthumb	\
	-Wl,--warn-common \
	-fPIE \
	-Wl,-Map,$(PEBBLE_HOME)/pebble-app.map,--emit-relocs \
	-T/Users/hudson/build/pebble/th/hoelaat/pebble_app.ld \
	-L$(PEBBLE_HOME)/lib \
	-lpebble

%.bin: %.elf
	$(OBJCOPY) -O binary $< $@

%.pbw: %.bin
	$(PYTHON) $(PEBBLE_HOME)/tools/mkbundle.py \
		--watchapp $< \
		--watchapp-timestamp "`date "+%s"`" \
		--req-fw 1 \
		--resources resources.pbpack \
		--resource-map resource_map.json \
		--resources-timestamp "`date "+%s"`" \
		-o $@ \

all: $(TARGET).pbw
$(TARGET).pbw: resources.pbpack
$(TARGET).elf: $(OBJS)
	$(LD) -o $@ $^ $(LDFLAGS)

clean:
	$(RM) *.elf *.o *.a a.out core