Skip to content

Commit

Permalink
makefiles: add TOCLEAN and TODISTCLEAN variables
Browse files Browse the repository at this point in the history
So that includers of src/prog.mk or src/so.mk can just define anything
extra that needs to be cleaned without having to override the "clean"
target (or having to declare a "distclean" target).

Example usage:

    TOCLEAN += foo
    TODISTCLEAN += bar
  • Loading branch information
kmk3 committed Nov 21, 2022
1 parent 3dcc7fa commit cbdee65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/prog.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $(PROG): $(OBJS) $(ROOT)/config.mk
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS)

.PHONY: clean
clean:; rm -fr *.o $(PROG) *.gcov *.gcda *.gcno *.plist
clean:; rm -fr *.o $(PROG) *.gcov *.gcda *.gcno *.plist $(TOCLEAN)

.PHONY: distclean
distclean: clean
distclean: clean; rm -fr $(TODISTCLEAN)
4 changes: 2 additions & 2 deletions src/so.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $(SO): $(OBJS) $(ROOT)/config.mk
$(CC) $(LDFLAGS) -shared -fPIC -z relro -o $@ $(OBJS) -ldl

.PHONY: clean
clean:; rm -fr $(OBJS) $(SO) *.plist
clean:; rm -fr $(OBJS) $(SO) *.plist $(TOCLEAN)

.PHONY: distclean
distclean: clean
distclean: clean; rm -fr $(TODISTCLEAN)

0 comments on commit cbdee65

Please sign in to comment.