From b0a905b14ff90f2240e5aa2928d5329d8494cb46 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Tue, 24 May 2022 22:06:09 +0200 Subject: fix `make clean` --- client/makefile | 6 +++--- robot/makefile | 6 +++--- shared/makefile | 3 +++ 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 -- cgit v1.2.3