aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-24 22:06:09 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-24 22:06:09 +0200
commitb0a905b14ff90f2240e5aa2928d5329d8494cb46 (patch)
tree51c488dc72f0ba50b666d57eea6a23f8c8a731b7
parent937a3a736aaf2c468c8c8e8dbc7963a87eae890f (diff)
fix `make clean`
-rw-r--r--client/makefile6
-rw-r--r--robot/makefile6
-rw-r--r--shared/makefile3
3 files changed, 9 insertions, 6 deletions
diff --git a/client/makefile b/client/makefile
index 2209c95..8bc8ac7 100644
--- a/client/makefile
+++ b/client/makefile
@@ -4,20 +4,20 @@ RM = rm -f
CFLAGS =
EXECNAME = main
+all: $(EXECNAME)
+
SOURCES := $(wildcard *.c)
HEADERS := $(wildcard *.h)
include ../shared/makefile
OBJECTS := $(patsubst %.c,%.o, $(SOURCES))
-all: main
-
.o:
$(CC) -c $(CFLAGS) $<
$(EXECNAME): $(OBJECTS)
$(CC) $(OBJECTS) -o $(EXECNAME)
-clean:
+clean::
$(RM) $(EXECNAME) *.o
format:
diff --git a/robot/makefile b/robot/makefile
index cd5c032..6de886c 100644
--- a/robot/makefile
+++ b/robot/makefile
@@ -10,6 +10,8 @@ PORT ?= /dev/ttyACM0
CFLAGS=-g -Wall $(DEVICE_SPECIFIC_CFLAGS) -Os
LDFLAGS=-Wl,-gc-sections -Wl,-relax
+all: $(if $(SIM), a.out, out.hex)
+
SOURCES := $(filter-out sim.c, $(wildcard *.c))
HEADERS := $(filter-out sim.h, $(wildcard *.h))
include ../shared/makefile
@@ -32,9 +34,7 @@ OBJ2HEX=$(PREFIX)objcopy
BUILD_STR=$(shell git update-index -q --refresh; git describe --tags --dirty='*' --broken='x' | cut -c1-20)
CFLAGS += -DW2_BUILD_STR="$(BUILD_STR)"
-all: $(if $(SIM), a.out, out.hex)
-
-clean:
+clean::
rm -f *.o out.hex a.out
a.out: $(OBJECTS)
diff --git a/shared/makefile b/shared/makefile
index 815d33c..cfdf8ac 100644
--- a/shared/makefile
+++ b/shared/makefile
@@ -1,2 +1,5 @@
SOURCES += $(wildcard ../shared/*.c)
HEADERS += $(wildcard ../shared/*.h)
+
+clean::
+ rm -f ../shared/*.o