build: standardize clean/distclean targets in src

Changes:

* clean: remove the same types of files in src/prog.mk and src/so.mk
* distclean: remove unused recipes and DISTCLEANFILES variable
This commit is contained in:
Kelvin M. Klann 2023-06-18 04:27:22 -03:00
parent b9864fd46f
commit 75587a4de4
3 changed files with 8 additions and 6 deletions

View file

@ -64,3 +64,5 @@ LIBS=@LIBS@
EXTRA_CFLAGS +=@EXTRA_CFLAGS@
EXTRA_LDFLAGS +=@EXTRA_LDFLAGS@
CLEANFILES = *.o *.gcov *.gcda *.gcno *.plist

View file

@ -3,7 +3,7 @@
# Note: $(ROOT)/config.mk must be included before this file.
#
# The includer should probably define PROG and TARGET and may also want to
# define EXTRA_HDRS, EXTRA_OBJS, CLEANFILES and DISTCLEANFILES.
# define EXTRA_HDRS and EXTRA_OBJS and extend CLEANFILES.
HDRS := $(sort $(wildcard *.h)) $(EXTRA_HDRS)
SRCS := $(sort $(wildcard *.c))
@ -33,7 +33,7 @@ $(PROG): $(OBJS) $(ROOT)/config.mk
$(CC) $(PROG_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
.PHONY: clean
clean:; rm -fr *.o $(PROG) *.gcov *.gcda *.gcno *.plist $(CLEANFILES)
clean:; rm -fr $(PROG) $(CLEANFILES)
.PHONY: distclean
distclean: clean; rm -fr $(DISTCLEANFILES)
distclean: clean

View file

@ -3,7 +3,7 @@
# Note: $(ROOT)/config.mk must be included before this file.
#
# The includer should probably define SO and TARGET and may also want to define
# EXTRA_HDRS, EXTRA_OBJS, CLEANFILES and DISTCLEANFILES.
# EXTRA_HDRS and EXTRA_OBJS and extend CLEANFILES.
HDRS := $(sort $(wildcard *.h)) $(EXTRA_HDRS)
SRCS := $(sort $(wildcard *.c))
@ -28,7 +28,7 @@ $(SO): $(OBJS) $(ROOT)/config.mk
$(CC) $(SO_LDFLAGS) -shared -fPIC -z relro $(LDFLAGS) -o $@ $(OBJS) -ldl
.PHONY: clean
clean:; rm -fr $(OBJS) $(SO) *.plist $(CLEANFILES)
clean:; rm -fr $(SO) $(CLEANFILES)
.PHONY: distclean
distclean: clean; rm -fr $(DISTCLEANFILES)
distclean: clean