From c7edaaa7c5e567360fd22566309383b533ce61b0 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Tue, 21 Jun 2022 08:58:26 -0400 Subject: [PATCH] Fix Makefiles for parallel builds --- Makefile | 25 ++++++++++++++----------- amgprec/Makefile | 11 +++++++---- amgprec/impl/Makefile | 25 ++++++++++++++----------- amgprec/impl/aggregator/Makefile | 4 +++- amgprec/impl/level/Makefile | 7 ++----- amgprec/impl/smoother/Makefile | 8 +++----- amgprec/impl/solver/Makefile | 8 +++----- cbind/Makefile | 8 ++++---- cbind/amgprec/Makefile | 3 ++- 9 files changed, 52 insertions(+), 47 deletions(-) diff --git a/Makefile b/Makefile index 63b95068..ca66d9c4 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,13 @@ include Make.inc -all: library +all: objs lib -library: libdir amgp cbnd -#cbnd +objs: amgp cbnd + +lib: libdir objs + cd amgprec && $(MAKE) lib + cd cbind && $(MAKE) lib libdir: (if test ! -d lib ; then mkdir lib; fi) @@ -14,9 +17,9 @@ libdir: amgp: - $(MAKE) -C amgprec all + cd amgprec && $(MAKE) objs cbnd: amgp - $(MAKE) -C cbind all + cd cbind && $(MAKE) objs install: all mkdir -p $(INSTALL_LIBDIR) &&\ $(INSTALL_DATA) lib/*.a $(INSTALL_LIBDIR) @@ -41,14 +44,14 @@ cleanlib: (cd modules; /bin/rm -f *.a *$(.mod) *$(.fh)) veryclean: cleanlib - (cd amgprec; make veryclean) - (cd samples/simple/fileread; make clean) - (cd samples/simple/pdegen; make clean) - (cd samples/advanced/fileread; make clean) - (cd samples/advanced/pdegen; make clean) + (cd amgprec && $(MAKE) veryclean) + (cd samples/simple/fileread && $(MAKE) clean) + (cd samples/simple/pdegen && $(MAKE) clean) + (cd samples/advanced/fileread && $(MAKE) clean) + (cd samples/advanced/pdegen && $(MAKE) clean) check: all make check -C samples/advanced/pdegen clean: - (cd amgprec; make clean) + (cd amgprec && $(MAKE) clean) diff --git a/amgprec/Makefile b/amgprec/Makefile index 0adac3e9..b6b4d1a4 100644 --- a/amgprec/Makefile +++ b/amgprec/Makefile @@ -62,12 +62,15 @@ OBJS=$(MODOBJS) LOCAL_MODS=$(MODOBJS:.o=$(.mod)) LIBNAME=libamg_prec.a -all: lib impld +all: objs impld -impld: $(OBJS) - $(MAKE) -C impl +objs: $(OBJS) + +impld: objs + cd impl && $(MAKE) lib: $(OBJS) impld + cd impl && $(MAKE) lib $(AR) $(HERE)/$(LIBNAME) $(OBJS) $(RANLIB) $(HERE)/$(LIBNAME) /bin/cp -p $(HERE)/$(LIBNAME) $(LIBDIR) @@ -218,4 +221,4 @@ clean: implclean /bin/rm -f $(OBJS) $(LOCAL_MODS) *$(.mod) implclean: - $(MAKE) -C impl clean + cd impl && $(MAKE) clean diff --git a/amgprec/impl/Makefile b/amgprec/impl/Makefile index 811ec7ea..826c7dd1 100644 --- a/amgprec/impl/Makefile +++ b/amgprec/impl/Makefile @@ -67,22 +67,25 @@ OBJS=$(F90OBJS) $(COBJS) $(MPCOBJS) LIBNAME=libamg_prec.a +objs: $(OBJS) aggrd levd smoothd solvd + lib: $(OBJS) aggrd levd smoothd solvd + cd aggregator && $(MAKE) lib + cd level && $(MAKE) lib + cd smoother && $(MAKE) lib + cd solver && $(MAKE) lib $(AR) $(HERE)/$(LIBNAME) $(OBJS) $(RANLIB) $(HERE)/$(LIBNAME) aggrd: - $(MAKE) -C aggregator + cd aggregator && $(MAKE) objs levd: - $(MAKE) -C level + cd level && $(MAKE) objs smoothd: - $(MAKE) -C smoother + cd smoother && $(MAKE) objs solvd: - $(MAKE) -C solver + cd solver && $(MAKE) objs -mpobjs: - (make $(MPFOBJS) FC="$(MPFC)" FCOPT="$(FCOPT)") - (make $(MPCOBJS) CC="$(MPCC)" CCOPT="$(CCOPT)") veryclean: clean /bin/rm -f $(LIBNAME) @@ -91,10 +94,10 @@ clean: solvclean smoothclean levclean aggrclean /bin/rm -f $(OBJS) $(LOCAL_MODS) aggrclean: - $(MAKE) -C aggregator clean + cd aggregator && $(MAKE) clean levclean: - $(MAKE) -C level clean + cd level && $(MAKE) clean smoothclean: - $(MAKE) -C smoother clean + cd smoother && $(MAKE) clean solvclean: - $(MAKE) -C solver clean + cd solver && $(MAKE) clean diff --git a/amgprec/impl/aggregator/Makefile b/amgprec/impl/aggregator/Makefile index d857a3b0..75079098 100644 --- a/amgprec/impl/aggregator/Makefile +++ b/amgprec/impl/aggregator/Makefile @@ -68,7 +68,9 @@ OBJS = $(FOBJS) $(MPCOBJS) LIBNAME=libamg_prec.a -lib: $(OBJS) +objs: $(OBJS) + +lib: objs $(AR) $(HERE)/$(LIBNAME) $(OBJS) $(RANLIB) $(HERE)/$(LIBNAME) diff --git a/amgprec/impl/level/Makefile b/amgprec/impl/level/Makefile index 80d782da..861769f3 100644 --- a/amgprec/impl/level/Makefile +++ b/amgprec/impl/level/Makefile @@ -72,14 +72,11 @@ amg_z_base_onelev_map_prol.o LIBNAME=libamg_prec.a -lib: $(OBJS) +objs: $(OBJS) +lib: objs $(AR) $(HERE)/$(LIBNAME) $(OBJS) $(RANLIB) $(HERE)/$(LIBNAME) -mpobjs: - (make $(MPFOBJS) FC="$(MPFC)" FCOPT="$(FCOPT)") - (make $(MPCOBJS) CC="$(MPCC)" CCOPT="$(CCOPT)") - veryclean: clean /bin/rm -f $(LIBNAME) diff --git a/amgprec/impl/smoother/Makefile b/amgprec/impl/smoother/Makefile index 9004f395..f26b8f00 100644 --- a/amgprec/impl/smoother/Makefile +++ b/amgprec/impl/smoother/Makefile @@ -190,14 +190,12 @@ amg_z_l1_jac_smoother_clone.o \ LIBNAME=libamg_prec.a -lib: $(OBJS) +objs: $(OBJS) + +lib: objs $(AR) $(HERE)/$(LIBNAME) $(OBJS) $(RANLIB) $(HERE)/$(LIBNAME) -mpobjs: - (make $(MPFOBJS) FC="$(MPFC)" FCOPT="$(FCOPT)") - (make $(MPCOBJS) CC="$(MPCC)" CCOPT="$(CCOPT)") - veryclean: clean /bin/rm -f $(LIBNAME) diff --git a/amgprec/impl/solver/Makefile b/amgprec/impl/solver/Makefile index 8a3a3570..f5d5b3c7 100644 --- a/amgprec/impl/solver/Makefile +++ b/amgprec/impl/solver/Makefile @@ -294,14 +294,12 @@ amg_z_krm_solver_impl.o LIBNAME=libamg_prec.a -lib: $(OBJS) +objs: $(OBJS) + +lib: objs $(AR) $(HERE)/$(LIBNAME) $(OBJS) $(RANLIB) $(HERE)/$(LIBNAME) -mpobjs: - (make $(MPFOBJS) FC="$(MPFC)" FCOPT="$(FCOPT)") - (make $(MPCOBJS) CC="$(MPCC)" CCOPT="$(CCOPT)") - veryclean: clean /bin/rm -f $(LIBNAME) diff --git a/cbind/Makefile b/cbind/Makefile index 377eb5c2..0ce2ea9a 100644 --- a/cbind/Makefile +++ b/cbind/Makefile @@ -8,19 +8,19 @@ MODDIR=../modules/ LIBNAME=$(CBINDLIBNAME) LIBNAME=libamg_cbind.a -all: lib -lib: amgprecd +objs: amgprecd +lib: objs /bin/cp -p $(CPUPDFLAG) $(HERE)/$(LIBNAME) $(LIBDIR) /bin/cp -p $(CPUPDFLAG) *.h $(INCDIR) /bin/cp -p $(CPUPDFLAG) *$(.mod) $(MODDIR) amgprecd: - $(MAKE) -C amgprec lib LIBNAME=$(LIBNAME) + cd amgprec && $(MAKE) objs LIBNAME=$(LIBNAME) clean: - $(MAKE) -C amgprec clean + cd amgprec &&$(MAKE) clean veryclean: clean diff --git a/cbind/amgprec/Makefile b/cbind/amgprec/Makefile index 80df067c..2d57d97a 100644 --- a/cbind/amgprec/Makefile +++ b/cbind/amgprec/Makefile @@ -18,8 +18,9 @@ LIBMOD=amg_prec_cbind_mod$(.mod) amg_dprec_cbind_mod$(.mod) amg_zprec_cbind_mod$ LOCAL_MODS=$(LIBMOD) #LIBNAME=$(CPRECLIBNAME) +objs: $(OBJS) -lib: $(OBJS) $(CMOD) +lib: objs $(CMOD) $(AR) $(HERE)/$(LIBNAME) $(OBJS) $(RANLIB) $(HERE)/$(LIBNAME) /bin/cp -p $(HERE)/$(LIBNAME) $(DEST)