diff --git a/Makefile b/Makefile index 4be618f5..feb1ab1c 100644 --- a/Makefile +++ b/Makefile @@ -13,18 +13,35 @@ # Requires GNU make. # -.PHONY: all clean doc +.PHONY: all clean distclean doc -all %: +all: cd src && $(MAKE) $(MAKECMDGOALS) + cd doc && $(MAKE) $(MAKECMDGOALS) doc: cd doc && $(MAKE) $(MAKECMDGOALS) clean: cd src && $(MAKE) $(MAKECMDGOALS) -# cd doc && $(MAKE) $(MAKECMDGOALS) + cd doc && $(MAKE) $(MAKECMDGOALS) + +# `make distclean' also removes files created by configuring +# the program. Running `make all distclean' prepares the project +# for packaging. +distclean: + cd src && $(MAKE) $(MAKECMDGOALS) + cd doc && $(MAKE) $(MAKECMDGOALS) rm -f config.h config.mk config.log config.status rm -f configure.scan autoscan.log rm -rf autom4te.cache/ rm -f *~ *.bak *# + +# This removes almost everything, including the configure script! +maintainer-clean: distclean + rm -f configure + +# Catch-all +%: + cd src && $(MAKE) $(MAKECMDGOALS) + \ No newline at end of file diff --git a/config.mk.in b/config.mk.in index dbfa9603..7c58d5e7 100644 --- a/config.mk.in +++ b/config.mk.in @@ -71,6 +71,9 @@ CXX_REPOSITORY = SHAREDLIB_SUFFIX = .so ARCHIVE_SUFFIX = .a +# Suffix of executables +EXEEXT := @EXEEXT@ + # ********************************************************************** # C Compiler CC = @CC@ diff --git a/doc/Makefile b/doc/Makefile index 4da6e308..a012f998 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -46,11 +46,16 @@ SHELL = /bin/sh # ********************************************************************** # Targets -.PHONY: all doc maintainer-clean +.PHONY: all clean distclean maintainer-clean doc doc: doxygen $(top_srcdir)/Doxyfile +clean: + +distclean: + $(RM) *~ *.bak *# + # This command is intended for maintainers to use; it deletes files # that may need special tools to rebuild. maintainer-clean: diff --git a/src/Makefile b/src/Makefile index 96ae6829..e5293dd2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -114,13 +114,15 @@ DEP = $(CCSRC:%.cpp=.%.d) $(BINSRC:%.cpp=.%.d) \ BINOBJ = $(BINSRC:.cpp=.o) BINARY = $(BINSRC:.cpp=) +EXECUTABLE = $(BINSRC:.cpp=$(EXEEXT)) EXIV2OBJ = $(EXIV2MAIN:.cpp=.o) $(EXIV2SRC:.cpp=.o) $(EXIVCSRC:.c=.o) EXIV2BIN = $(EXIV2MAIN:.cpp=) +EXIV2EXE = $(EXIV2MAIN:.cpp=$(EXEEXT)) MCOBJ = $(MCMAIN:.cpp=.o) $(MCSRC:.cpp=.o) MCBIN = $(MCMAIN:.cpp=) - +MCEXE = $(MCMAIN:.cpp=$(EXEEXT)) ARCHIVE = lib$(LIBNAME)$(ARCHIVE_SUFFIX) SHAREDLIB = lib$(LIBNAME)$(SHAREDLIB_SUFFIX) @@ -239,7 +241,7 @@ bin: lib $(BINARY) $(EXIV2BIN) $(MCBIN) install: $(INSTALL) $(INSTALL_DIRS) $(bindir) - @list='$(EXIV2BIN)'; for p in $$list; do \ + @list='$(EXIV2EXE)'; for p in $$list; do \ if test -f $$p; then \ echo "$(INSTALL_PROGRAM) $$p $(bindir)/$$p"; \ $(INSTALL_PROGRAM) $$p $(bindir)/$$p; \ @@ -266,7 +268,7 @@ install-sharedlib: sharedlib install-lib: $(INSTALL_LIB) install-header uninstall: $(UNINSTALL) - @list='$(EXIV2BIN)'; for p in $$list; do \ + @list='$(EXIV2EXE)'; for p in $$list; do \ echo "rm -f $(bindir)/$$p"; \ rm -f $(bindir)/$$p; \ done @@ -305,17 +307,17 @@ mostlyclean: clean: mostlyclean $(RM) $(ARCHIVE) $(SHAREDLIB) - $(RM) $(BINARY) $(EXIV2BIN) $(MCBIN) + $(RM) $(EXECUTABLE) $(EXIV2EXE) $(MCEXE) # Run `make distclean' from the top source directory to also remove # files created by configuring the program. distclean: clean $(RM) tags TAGS - $(RM) $(DEP) - $(RM) .mn.d $(RM) *~ *# # This command is intended for maintainers to use; it deletes files # that may need special tools to rebuild. maintainer-clean: uninstall uninstall-lib distclean + $(RM) $(DEP) + $(RM) .mn.d $(RM) mn.cpp