Skip to content

Commit

Permalink
build: improve the clean target
Browse files Browse the repository at this point in the history
* Uses a sentinel file for the obj directory.
* Removes the binary with 'make clean'.
* Uses 'rm -f` to ensure the clean target always succeeds.
  • Loading branch information
orbea committed Jan 7, 2025
1 parent 76c5e02 commit be2a220
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,18 @@ ifeq ($(TARGET),gtk)
endif

all: $(FNAME_$(TARGET))
obj:
mkdir obj
clean: | obj
rm obj/* || true

obj/.tag:
@mkdir -p obj
@touch $@

clean:
rm -rf obj/
rm -f $(FNAME_$(TARGET))

ifeq ($(TARGET),windows)
XFILES += obj/rc.o
obj/rc.o: flips.rc flips.h | obj
obj/rc.o: flips.rc flips.h obj/.tag
windres flips.rc obj/rc.o
endif

Expand Down

0 comments on commit be2a220

Please sign in to comment.