From c2761cb4a8e93434470c1c6cac15b950413e1add Mon Sep 17 00:00:00 2001 From: Jasmin Jessich Date: Sun, 21 May 2017 00:26:28 +0200 Subject: [PATCH] More Makefile adaptations - Generate dependency files ".*.edep" out of the "*.ecpp" files and include them in pages/Makefile. - Allow building of "/*.o" from the top makefile as target. - .gitignore will ignore the new dependency files ".*.edep". --- .gitignore | 1 + Makefile | 10 ++++++++++ pages/Makefile | 9 ++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 020d64b9..2ca3fe08 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ po/live.pot .cvsignore .libs locale +.*.edep diff --git a/Makefile b/Makefile index a972dc8b..41219131 100644 --- a/Makefile +++ b/Makefile @@ -95,6 +95,15 @@ SUBDIRS := $(WEB_DIR_PAGES) $(WEB_DIR_CSS) $(WEB_DIR_JAVA) all: lib i18n ### Implicit rules: +$(WEB_DIR_PAGES)/%.o: $(WEB_DIR_PAGES)/%.cpp $(WEB_DIR_PAGES)/%.ecpp + $(MAKE) -C $(WEB_DIR_PAGES) PLUGINFEATURES="$(PLUGINFEATURES)" $(notdir $@) + +$(WEB_DIR_CSS)/%.o: + $(MAKE) -C $(WEB_DIR_CSS) PLUGINFEATURES="$(PLUGINFEATURES)" $(notdir $@) + +$(WEB_DIR_JAVA)/%.o: + $(MAKE) -C $(WEB_DIR_JAVA) PLUGINFEATURES="$(PLUGINFEATURES)" $(notdir $@) + %.o: %.cpp $(CXX) $(CXXFLAGS) -c $(DEFINES) $(PLUGINFEATURES) $(INCLUDES) $< @@ -194,5 +203,6 @@ clean: subdirs .PRECIOUS: $(I18Npo) +.PHONY: FORCE FORCE: diff --git a/pages/Makefile b/pages/Makefile index cfe482cb..018f2562 100644 --- a/pages/Makefile +++ b/pages/Makefile @@ -18,6 +18,7 @@ OBJS := menu.o recordings.o schedule.o multischedule.o screenshot.o \ recstream.o users.o edit_user.o edit_recording.o osd.o SRCS := $(patsubst %.o,%.cpp,$(OBJS)) ESRCS := $(patsubst %.o,%.ecpp,$(OBJS)) +ESRCS_DEPS := $(patsubst %.o,.%.edep,$(OBJS)) ### The main target: all: libpages.a @@ -30,6 +31,9 @@ all: libpages.a %.cpp: %.ecpp $(ECPPC) $(ECPPFLAGS) $(ECPPFLAGS_CPP) $< +.%.edep: %.ecpp + @$(ECPPC) -M $(ECPPFLAGS) $(ECPPFLAGS_CPP) $< > $@ + ### Dependencies: MAKEDEP := $(CXX) -MM -MG DEPFILE := .dependencies @@ -38,6 +42,7 @@ $(DEPFILE): Makefile $(SRCS) $(ESRCS) ifneq ($(MAKECMDGOALS),clean) -include $(DEPFILE) +-include $(ESRCS_DEPS) endif ### Targets: @@ -45,7 +50,9 @@ libpages.a: $(OBJS) $(AR) r $@ $^ clean: - @rm -f *~ *.o core* libpages.a $(SRCS) $(DEPFILE) + @rm -f *~ *.o core* libpages.a $(SRCS) $(DEPFILE) $(ESRCS_DEPS) dist: clean @echo "Nothing to do for distribution here ..." + +.PRECIOUS: $(SRCS)