Skip to content

Commit

Permalink
Refactor recursive makefiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matlo committed May 17, 2015
1 parent 5677654 commit 62d88cb
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 14 deletions.
45 changes: 36 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
DIRS=shared utils core config launcher fpsconfig
DIRS = utils shared core config launcher fpsconfig

ifneq ($(OS),Windows_NT)
DIRS+= po
endif

all:
+for i in $(DIRS); do $(MAKE) -C $$i all; done
BUILDDIRS = $(DIRS:%=build-%)
INSTALLDIRS = $(DIRS:%=install-%)
CLEANDIRS = $(DIRS:%=clean-%)
UNINSTALLDIRS = $(DIRS:%=uninstall-%)

clean:
+for i in $(DIRS); do $(MAKE) -C $$i clean; done
all: $(BUILDDIRS)
$(DIRS): $(BUILDDIRS)
$(BUILDDIRS):
$(MAKE) -C $(@:build-%=%)

build-core: build-shared
build-config: build-shared
build-launcher: build-shared
build-fpsconfig: build-shared

clean: $(CLEANDIRS)
$(CLEANDIRS):
$(MAKE) -C $(@:clean-%=%) clean

ifeq ($(OS),Windows_NT)
install: all
Expand Down Expand Up @@ -56,12 +69,26 @@ endif
mkdir -p setup/ssl/certs
cp -u -f /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem setup/ssl/certs/ca-bundle.crt

.PHONY: subdirs $(DIRS)
.PHONY: subdirs $(BUILDDIRS)
.PHONY: subdirs $(CLEANDIRS)
.PHONY: all install clean
else
install: all
for i in $(DIRS); do $(MAKE) -C $$i install; done

uninstall:
-for i in $(DIRS); do $(MAKE) -C $$i uninstall; done
install: $(INSTALLDIRS) all
$(INSTALLDIRS):
$(MAKE) -C $(@:install-%=%) install

uninstall: $(UNINSTALLDIRS) all
$(UNINSTALLDIRS):
$(MAKE) -C $(@:uninstall-%=%) uninstall

really-clean: clean uninstall

.PHONY: subdirs $(DIRS)
.PHONY: subdirs $(BUILDDIRS)
.PHONY: subdirs $(INSTALLDIRS)
.PHONY: subdirs $(UNINSTALLDIRS)
.PHONY: subdirs $(CLEANDIRS)
.PHONY: all install uninstall clean
endif
28 changes: 23 additions & 5 deletions shared/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
DIRS=controller event updater configupdater configeditor gpp
DIRS = controller event updater configupdater configeditor gpp

all:
+for i in $(DIRS); do $(MAKE) -C $$i all; done
BUILDDIRS = $(DIRS:%=build-%)
INSTALLDIRS = $(DIRS:%=install-%)
CLEANDIRS = $(DIRS:%=clean-%)
UNINSTALLDIRS = $(DIRS:%=uninstall-%)

clean:
+for i in $(DIRS); do $(MAKE) -C $$i clean; done
all: $(BUILDDIRS)
$(DIRS): $(BUILDDIRS)
$(BUILDDIRS):
$(MAKE) -C $(@:build-%=%)

build-configeditor: build-controller

clean: $(CLEANDIRS)
$(CLEANDIRS):
$(MAKE) -C $(@:clean-%=%) clean

install: $(INSTALLDIRS) all
$(INSTALLDIRS): ;

.PHONY: subdirs $(DIRS)
.PHONY: subdirs $(BUILDDIRS)
.PHONY: subdirs $(CLEANDIRS)
.PHONY: all clean

0 comments on commit 62d88cb

Please sign in to comment.