Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support parallel Make in Legacy build system #686

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replace make->$(MAKE) to support parallel jobs
  • Loading branch information
rcabell authored and scrasmussen committed Mar 17, 2023
commit 6c4741f07aaa188cfb2778cb9ef2c36a49b5d04a
4 changes: 2 additions & 2 deletions src/CPL/CLM_cpl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ all: $(OBJS)
#

clean:
rm -f *.o *.mod *.stb *~
cd ../..; make -f Makefile.comm clean
rm -f *.o $(MAKE) *.stb *~
cd ../..; $(MAKE) -f Makefile.comm clean
8 changes: 4 additions & 4 deletions src/CPL/CLM_cpl/Makefile.cpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Makefile
# Makefile

all:
(cd ../../; make -f Makefile.comm)
(make)
(cd ../../; $(MAKE) -f Makefile.comm)
($(MAKE))

clean:
(cd ../../; make -f Makefile.comm clean)
(cd ../../; $(MAKE) -f Makefile.comm clean)
2 changes: 1 addition & 1 deletion src/CPL/LIS_cpl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.SUFFIXES: .o .F
LIS_ROOT = ../../../..

LIS_MOD = -I ../../mod -I$(LIS_ROOT)/make
LIS_MOD = -I ../../mod -I$(LIS_ROOT)/$(MAKE)
include $(LIS_ROOT)/make/configure.lis
include ../../macros

Expand Down
8 changes: 4 additions & 4 deletions src/CPL/LIS_cpl/Makefile.cpl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Makefile
# Makefile

all:
(cd ../../; make -f Makefile.comm)
(cd ../../; $(MAKE) -f Makefile.comm)
(make)

clean:
(make clean)
(cd ../../; make -f Makefile.comm clean)
($(MAKE) clean)
(cd ../../; $(MAKE) -f Makefile.comm clean)
4 changes: 2 additions & 2 deletions src/CPL/NUOPC_cpl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ build_model:
$(call checkdir, $(MODEL_DIR))
mkdir -p $(MODEL_LIBDIR)
mkdir -p $(MODEL_MODDIR)
make -C $(MODEL_DIR) -f $(MODEL_MK)
$(MAKE) -C $(MODEL_DIR) -f $(MODEL_MK)

$(MODEL_MODS): build_model

Expand Down Expand Up @@ -347,7 +347,7 @@ nuopcdistclean: nuopcclean
@echo "Cleaning Model build..."
@echo ""
$(call checkdir, $(MODEL_DIR))
make -C $(MODEL_DIR) -f $(MODEL_MK) clean
$(MAKE) -C $(MODEL_DIR) -f $(MODEL_MK) clean

# #########
# Clean Cap
Expand Down
10 changes: 5 additions & 5 deletions src/CPL/WRF_cpl/Makefile.cpl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Makefile
# Makefile

all:
(cd ../../; make -f Makefile.comm BASIC)
(make)
(cd ../../; $(MAKE) -f Makefile.comm BASIC)
($(MAKE))

clean:
(make clean)
(cd ../../; make -f Makefile.comm clean)
($(MAKE) clean)
(cd ../../; $(MAKE) -f Makefile.comm clean)
2 changes: 1 addition & 1 deletion src/Land_models/Noah/GRAPHICS/HORIZ/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CMD= plt2d.exe


# Lines from here on down should not need to be changed. They are the
# actual rules which make uses to build $(CMD).
# actual rules which $(MAKE) uses to build $(CMD).
#

all: $(CMD)
Expand Down
2 changes: 1 addition & 1 deletion src/Land_models/Noah/GRAPHICS/TIME_SERIES/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ CMD= pltts.exe


# Lines from here on down should not need to be changed. They are the
# actual rules which make uses to build $(CMD).
# actual rules which $(MAKE) uses to build $(CMD).
#

all: $(CMD)
Expand Down
12 changes: 6 additions & 6 deletions src/Land_models/Noah/HRLDAS_COLLECT_DATA/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ OBJS= consolidate_grib.o
CMD= consolidate_grib.exe

default:
(cd lib; make)
(make -f Makefile all)
(cd lib; $(MAKE))
($(MAKE) -f Makefile all)

all: lib/libsmda.a $(CMD)
(cd lib; make)
(cd lib; $(MAKE))

lib/libsmda.a:
(cd lib; make)
(cd lib; $(MAKE))

%.o: %.F
@echo ""
$(COMPILERF90) $(CPPINVOKE) $(CPPFLAGS) $(FREESOURCE) $(F90FLAGS) -c $(NETCDFMOD) -I./lib $(MODFLAG)./lib $(*).F

$(CMD): lib/libsmda.a $(OBJS)
(cd lib; make)
(cd lib; $(MAKE))
$(COMPILERF90) -o $(@) -I./lib $(F90FLAGS) $(MODFLAG)./lib $(OBJS) \
-L./lib -lsmda $(NETCDFLIB) $(HDF5LIB) $(BZIP2_LIB) $(LIBJASPER)

clean:
$(RM) *.o *~ *.exe *.mod
(cd lib; make clean)
(cd lib; $(MAKE) clean)
#


Expand Down
4 changes: 2 additions & 2 deletions src/Land_models/Noah/HRLDAS_COLLECT_DATA/run/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
all:
( cd ..; make )
( cd ..; $(MAKE) )

clean:
( cd ..; make clean )
( cd ..; $(MAKE) clean )
36 changes: 18 additions & 18 deletions src/Land_models/Noah/Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@

all: user_build_options
(cd Utility_routines; make)
(cd Noah; make)
(cd IO_code; make)
(cd Run; make -f Makefile)
# (cd HRLDAS_COLLECT_DATA; make)
(cd Utility_routines; $(MAKE))
(cd Noah; $(MAKE))
(cd IO_code; $(MAKE))
(cd Run; $(MAKE) -f Makefile)
# (cd HRLDAS_COLLECT_DATA; $(MAKE))

clean:
(cd Utility_routines; make clean)
(cd Noah; make clean)
(cd IO_code; make clean)
(cd Run; make -f Makefile clean)
(cd HRLDAS_COLLECT_DATA; make clean)
(cd Utility_routines; $(MAKE) clean)
(cd Noah; $(MAKE) clean)
(cd IO_code; $(MAKE) clean)
(cd Run; $(MAKE) -f Makefile clean)
(cd HRLDAS_COLLECT_DATA; $(MAKE) clean)

test: all
(cd TEST; ../HRLDAS_COLLECT_DATA/consolidate_grib.exe )
(cd TEST; ../Run/Noah_hrldas_beta )

#all: check user_build_options
# (cd Utility_routines; make)
# (cd Noah; make)
# (cd IO_code; make)
# (cd Run; make)
# (cd Utility_routines; $(MAKE))
# (cd Noah; $(MAKE))
# (cd IO_code; $(MAKE))
# (cd Run; $(MAKE))
#
#clean:
# (cd Utility_routines; make clean)
# (cd Noah; make clean)
# (cd IO_code; make clean)
# (cd Run; make clean)
# (cd Utility_routines; $(MAKE) clean)
# (cd Noah; $(MAKE) clean)
# (cd IO_code; $(MAKE) clean)
# (cd Run; $(MAKE) clean)
#
#include user_build_options
#
Expand Down
6 changes: 3 additions & 3 deletions src/Land_models/Noah/Utility_programs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ include ../user_build_options
CMD= hrldas_extract_point gribextract gribedition gribbyte modify_wrfinput geth_newdate

all: $(CMD)
( cd gcip_sw_to_grib; make )
( cd gcip_sw_to_grib; $(MAKE) )

#
# Compile the module_date_utilities from the Utility_routines directory
Expand Down Expand Up @@ -65,9 +65,9 @@ hrldas_extract_point.o: lccone.o

clean:
$(RM) *.o *~ $(CMD) *.mod
( cd gcip_sw_to_grib; make clean )
( cd gcip_sw_to_grib; $(MAKE) clean )
neat:
$(RM) *.o *~ *.mod
( cd gcip_sw_to_grib; make neat )
( cd gcip_sw_to_grib; $(MAKE) neat )
#

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RM = rm -f
CMD= okmeso_statistics.exe

# Lines from here on down should not need to be changed. They are the
# actual rules which make uses to build $(CMD).
# actual rules which $(MAKE) uses to build $(CMD).
#
all: $(CMD)

Expand Down
12 changes: 6 additions & 6 deletions src/Land_models/NoahMP/HRLDAS_forcing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ OBJS= create_forcing.o
CMD= create_forcing.exe

default:
(cd lib; make)
(make -f Makefile all)
(cd lib; $(MAKE))
($(MAKE) -f Makefile all)

all: lib/libsmda.a $(CMD)
(cd lib; make)
(cd lib; $(MAKE))

lib/libsmda.a:
(cd lib; make)
(cd lib; $(MAKE))

%.o: %.F
@echo ""
$(COMPILERF90) $(CPPINVOKE) $(CPPFLAGS) $(CPP_NETCDF4_COMPRESS) $(FREESOURCE) $(F90FLAGS) $(LDFLAGS) -c $(NETCDFMOD) -I./lib -I./lib $(*).F

$(CMD): lib/libsmda.a $(OBJS)
(cd lib; make)
(cd lib; $(MAKE))
$(COMPILERF90) -o $(@) -I./lib $(F90FLAGS) $(LDFLAGS) -I./lib $(OBJS) \
-L./lib -lsmda $(NETCDFLIB) $(BZIP2_LIB) $(LIBJASPER)

clean:
$(RM) *.o *~ *.exe *.mod
(cd lib; make clean)
(cd lib; $(MAKE) clean)
#


Expand Down
4 changes: 2 additions & 2 deletions src/Land_models/NoahMP/HRLDAS_forcing/run/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
all:
( cd ..; make )
( cd ..; $(MAKE) )

clean:
( cd ..; make clean )
( cd ..; $(MAKE) clean )
30 changes: 15 additions & 15 deletions src/Land_models/NoahMP/Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@

all: user_build_options
(cd Utility_routines; make)
(cd phys; make)
(cd data_structures; make)
(cd IO_code; make)
(cd run; make)
(cd Utility_routines; $(MAKE))
(cd phys; $(MAKE))
(cd data_structures; $(MAKE))
(cd IO_code; $(MAKE))
(cd run; $(MAKE))

clean:
(cd Utility_routines; make clean)
(cd phys; make clean)
(cd data_structures; make clean)
(cd IO_code; make clean)
(cd run; make clean)
(cd Utility_routines; $(MAKE) clean)
(cd phys; $(MAKE) clean)
(cd data_structures; $(MAKE) clean)
(cd IO_code; $(MAKE) clean)
(cd run; $(MAKE) clean)

### explicitly point to other land model options
NoahMP: user_build_options
(cd Utility_routines; make)
(cd phys; make)
(cd data_structures; make)
(cd IO_code; make NoahMP MOD_OPT="-DNoahMP")
(cd run; make -f Makefile NoahMP)
(cd Utility_routines; $(MAKE))
(cd phys; $(MAKE))
(cd data_structures; $(MAKE))
(cd IO_code; $(MAKE) NoahMP MOD_OPT="-DNoahMP")
(cd run; $(MAKE) -f Makefile NoahMP)
30 changes: 15 additions & 15 deletions src/Land_models/NoahMP/hydro/Makefile.hydro
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@

all: user_build_options
(cd Utility_routines; make)
(cd phys; make)
(cd data_structures; make)
(cd IO_code; make)
(cd run; make)
(cd Utility_routines; $(MAKE))
(cd phys; $(MAKE))
(cd data_structures; $(MAKE))
(cd IO_code; $(MAKE))
(cd run; $(MAKE))

clean:
(cd Utility_routines; make clean)
(cd phys; make clean)
(cd data_structures; make clean)
(cd IO_code; make clean)
(cd run; make clean)
(cd Utility_routines; $(MAKE) clean)
(cd phys; $(MAKE) clean)
(cd data_structures; $(MAKE) clean)
(cd IO_code; $(MAKE) clean)
(cd run; $(MAKE) clean)

### explicitly point to other land model options
NoahMP: user_build_options
(cd Utility_routines; make)
(cd phys; make)
(cd data_structures; make)
(cd IO_code; make NoahMP MOD_OPT="-DNoahMP")
(cd run; make -f Makefile NoahMP)
(cd Utility_routines; $(MAKE))
(cd phys; $(MAKE))
(cd data_structures; $(MAKE))
(cd IO_code; $(MAKE) NoahMP MOD_OPT="-DNoahMP")
(cd run; $(MAKE) -f Makefile NoahMP)
16 changes: 8 additions & 8 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ $(CMD):
(mkdir Run);\
fi
(rm -f Run/wrf_hydro.exe )
(make -f Makefile.comm)
($(MAKE) -f Makefile.comm)
@if [ -d "LandModel_cpl" ]; then \
(cd LandModel_cpl; make) \
(cd LandModel_cpl; $(MAKE)) \
fi
if [ $(WRF_HYDRO_RAPID) -eq 1 ]; then \
(cd lib;rm -f librapid.a); \
fi
if [ $(WRF_HYDRO_RAPID) -eq 1 ]; then \
(cd Rapid_routing; make -f makefile.cpl rapid); \
(cd Rapid_routing; $(MAKE) -f makefile.cpl rapid); \
fi

@if [ -d "LandModel" ]; then \
(cd LandModel; make ) \
(cd LandModel; $(MAKE) ) \
fi

debug::
Expand All @@ -37,13 +37,13 @@ test:
@echo "No libraries or utilities are built, skip testing."
clean:
@if [ -d "LandModel_cpl" ]; then \
(cd LandModel_cpl; make clean) \
(cd LandModel_cpl; $(MAKE) clean) \
fi
(make -f Makefile.comm clean)
($(MAKE) -f Makefile.comm clean)
@if [ -d "LandModel" ]; then \
(cd LandModel; make clean) \
(cd LandModel; $(MAKE) clean) \
fi
if [ $(WRF_HYDRO_RAPID) -eq 1 ]; then \
(cd Rapid_routing; make -f makefile.cpl clean); \
(cd Rapid_routing; $(MAKE) -f makefile.cpl clean); \
fi
(rm -f */*.mod */*.o lib/*.a Run/wrf_hydro.exe)
Loading