summaryrefslogtreecommitdiffstats
path: root/humidity_sensors/app/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'humidity_sensors/app/Makefile')
-rw-r--r--humidity_sensors/app/Makefile51
1 files changed, 51 insertions, 0 deletions
diff --git a/humidity_sensors/app/Makefile b/humidity_sensors/app/Makefile
new file mode 100644
index 0000000..01d0888
--- /dev/null
+++ b/humidity_sensors/app/Makefile
@@ -0,0 +1,51 @@
+CSRCS=main.c util.c uart.c i2c_bb.c clock.c gpio.c sht20.c stm8s_it.c awu.c
+PROG=build/main.hex
+LIBS=
+SPL_CSRCS =
+
+SPL_ROOT=../STM8S_StdPeriph_Lib
+SPL_SRC = $(SPL_ROOT)/Libraries/STM8S_StdPeriph_Driver/src
+SPL_INC = $(SPL_ROOT)/Libraries/STM8S_StdPeriph_Driver/inc
+
+CFLAGS=--opt-code-size --std-sdcc99 --all-callee-saves --verbose --stack-auto --fverbose-asm --float-reent
+CPPFLAGS=-I./ -I${SPL_INC} -DSTM8S003
+CC=sdcc-sdcc -mstm8
+AS=sdcc-sdasstm8
+STM8FLASH=../stm8flash/stm8flash
+
+LIBOBJ=${SPL_CSRCS:%.c=build/%.rel}
+OBJS=${CSRCS:%.c=build/%.rel} ${SPL_CSRCS:%.c=build/%.rel}
+
+${PROG}: ${OBJS}
+ ${CC} ${CFLAGS} ${CPPFLAGS} -o $@ ${OBJS}
+
+build/%.rel:${SPL_SRC}/%.c
+ ${CC} ${CFLAGS} ${CPPFLAGS} -o $@ -c $<
+
+build/%.rel:%.c
+ ${CC} ${CFLAGS} ${CPPFLAGS} -o $@ -c $<
+
+
+flash: ${PROG} ${STM8FLASH}
+ ${STM8FLASH} -c stlinkv2 -p stm8s003?3 -s flash -w ${PROG}
+
+${STM8FLASH}:
+ make -C $(dir $@)
+
+
+tidy:
+ astyle -A3 -s2 --attach-extern-c -L -c -w -Y -m0 -f -p -H -U -k3 -xj -xd ${CSRCS}
+
+protos:
+ echo > prototypes.h
+ cproto -E "${CC} -E ${CPPFLAGS} -D__trap= -D__interrupt\(a\)= -DPROTOS" ${CSRCS} > prototypes.h.tmp
+ /bin/mv -f prototypes.h.tmp prototypes.h
+
+clean:
+ /bin/rm -rf build *~ *.orig
+
+$(shell mkdir -p build)
+
+
+
+