aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authoriamcheeseman <[email protected]>2026-05-22 11:02:36 -0400
committeriamcheeseman <[email protected]>2026-05-22 11:02:36 -0400
commit0d07ba17500b6c44d17b6465c303e46175507557 (patch)
treec1c4e40b5c10c7b0f316f07849bbbc0ba0eb3bf9 /Makefile
parente375289782c924c0c382a752498fbd348ea7f918 (diff)
switch to a makefile
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile31
1 files changed, 31 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a5d1c86
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,31 @@
+include config.mk
+
+SRC=$(wildcard **/*.c)
+SRC+=$(wildcard teensy/platform/${PLATFORM}/**/*.c)
+SRC+=$(wildcard teensy/platform/${PLATFORM}/*.c)
+OBJ=$(SRC:%.c=.obj/%.o)
+
+.PHONY: all run clean
+
+all: Makefile.dep ${OUT}
+
+${OUT}: ${OBJ}
+ ${CC} -o $@ ${LDFLAGS} ${OBJ}
+
+.obj/%.o: %.c
+ @mkdir -p ${@D}
+ ${CC} -c -o $@ ${CFLAGS} $<
+
+config.mk:
+ cp config.def.mk config.mk
+
+Makefile.dep: ${SRC}
+ ${CC} ${CFLAGS} ${SRC} -MM > $@
+
+run: all
+ ${RUN_CMD} ./${OUT}
+
+clean:
+ rm -f ${OBJ} ${OUT}
+
+include Makefile.dep