Skip to content

Commit

Permalink
More Makefile adaptations
Browse files Browse the repository at this point in the history
- Generate dependency files ".*.edep" out of the "*.ecpp" files and include
  them in pages/Makefile.
- Allow building of "<subdir>/*.o" from the top makefile as target.
- .gitignore will ignore the new dependency files ".*.edep".
  • Loading branch information
jasmin-j committed May 20, 2017
1 parent eba2ad6 commit c2761cb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ po/live.pot
.cvsignore
.libs
locale
.*.edep
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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) $<

Expand Down Expand Up @@ -194,5 +203,6 @@ clean: subdirs

.PRECIOUS: $(I18Npo)

.PHONY: FORCE
FORCE:

9 changes: 8 additions & 1 deletion pages/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -38,14 +42,17 @@ $(DEPFILE): Makefile $(SRCS) $(ESRCS)

ifneq ($(MAKECMDGOALS),clean)
-include $(DEPFILE)
-include $(ESRCS_DEPS)
endif

### Targets:
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)

0 comments on commit c2761cb

Please sign in to comment.