From d4a2b4e27c886c541094a9b28c2ca896cbc60979 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Thu, 23 Mar 2017 13:28:00 +0100 Subject: [PATCH] Call subdir make only for one level #331. We can't control dependencies in case all the subdirs are processed from the upper most Makefile. So now the subdir make used to create the webextension and the script is called from the src/Makefile which knows somethings more about dependencies. --- Makefile | 18 +++++++----------- config.mk | 1 - src/Makefile | 17 ++++++++++++----- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index a554a39..e2af9b9 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ include config.mk -all: vimb +all: $(SRCDIR)/vimb options: @echo "vimb build options:" @@ -10,15 +10,10 @@ options: @echo "EXTCFLAGS = $(EXTCFLAGS)" @echo "CC = $(CC)" -vimb: $(SUBDIRS:%=%.subdir-all) +$(SRCDIR)/vimb: + @$(MAKE) $(MFLAGS) -C $(SRCDIR) -%.subdir-all: - @$(MAKE) $(MFLAGS) -C $* - -%.subdir-clean: - @$(MAKE) $(MFLAGS) -C $* clean - -install: vimb +install: $(SRCDIR)/vimb @# binary install -d $(BINPREFIX) install -m 755 $(SRCDIR)/vimb $(BINPREFIX)/vimb @@ -37,7 +32,8 @@ install: vimb uninstall: $(RM) $(BINPREFIX)/vimb $(DESTDIR)$(MANDIR)/man1/vimb.1 $(EXTPREFIX)/$(EXTTARGET) -clean: $(SUBDIRS:%=%.subdir-clean) +clean: + @$(MAKE) $(MFLAGS) -C $(SRCDIR) clean sandbox: @make $(MFLAGS) RUNPREFIX=$(CURDIR)/sandbox/usr PREFIX=/usr DESTDIR=./sandbox install @@ -45,4 +41,4 @@ sandbox: runsandbox: sandbox sandbox/usr/bin/vimb -.PHONY: all options clean install uninstall sandbox sandbox-clean +.PHONY: all vimb options clean install uninstall sandbox diff --git a/config.mk b/config.mk index c445f5a..93cd476 100644 --- a/config.mk +++ b/config.mk @@ -11,7 +11,6 @@ EXTPREFIX := $(RUNPREFIX)/lib/vimb # define some directories SRCDIR = src DOCDIR = doc -SUBDIRS = $(SRCDIR)/scripts $(SRCDIR)/webextension $(SRCDIR) # used libs LIBS = gtk+-3.0 'webkit2gtk-4.0 >= 2.3.5' diff --git a/src/Makefile b/src/Makefile index b1bd8be..d85bd26 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,17 +1,18 @@ BASEDIR=.. include $(BASEDIR)/config.mk -OBJ = $(patsubst %.c, %.o, $(wildcard *.c)) +SUBDIRS = scripts webextension +OBJ = $(patsubst %.c, %.o, $(wildcard *.c)) all: vimb -clean: +clean: $(SUBDIRS:%=%.subdir-clean) $(RM) vimb *.o -vimb: $(OBJ) - $(CC) $(LDFLAGS) $^ -o $@ +vimb: $(OBJ) webextension.subdir-all + $(CC) $(LDFLAGS) $(OBJ) -o $@ -$(OBJ): config.h $(BASEDIR)/config.mk +$(OBJ): scripts.subdir-all config.h $(BASEDIR)/config.mk -include $(OBJ:.o=.d) @@ -23,4 +24,10 @@ config.h: @echo "${CC} $@" @$(CC) $(CFLAGS) -c -o $@ $< +%.subdir-all: config.h + @$(MAKE) $(MFLAGS) -C $* + +%.subdir-clean: + @$(MAKE) $(MFLAGS) -C $* clean + .PHONY: all clean -- 2.20.1