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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 9 additions & 8 deletions src/CPL/CLM_cpl/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Makefile
# Makefile
#
.SUFFIXES:
.SUFFIXES: .o .F
Expand All @@ -13,19 +13,20 @@ MODFLAG = -I./ -I ../../MPP -I ../../mod

OBJS = \
module_clm_HYDRO.o \
clm_drv_HYDRO.o
all: $(OBJS)
clm_drv_HYDRO.o

.F.o:
all: $(OBJS)
ar -cr ../../lib/libHYDRO.a $(OBJS)

%.o: %.F
@echo ""
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -I$(NETCDFINC) -o $(@) $(F90FLAGS) $(MODFLAG) -I ../../mod $(CLM_MOD) $(*).F
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -I$(NETCDFINC) -o $(@) $(F90FLAGS) $(MODFLAG) -I ../../mod $(CLM_MOD) $<
@echo ""
ar -r ../../lib/libHYDRO.a $(@)

#
# Dependencies:
#

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)
15 changes: 8 additions & 7 deletions src/CPL/LIS_cpl/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Makefile
# Makefile
#

.SUFFIXES:
.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 All @@ -14,17 +14,18 @@ MODFLAG = -I./ -I ../../MPP -I ../../mod
OBJS = \
module_lis_HYDRO.o\
lis_drv_HYDRO.o
all: $(OBJS)

.F.o:
all: $(OBJS)
ar -r ../../lib/libHYDRO.a $(OBJS)

%.o: %.F
@echo ""
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -I$(NETCDFINC) -o $(@) $(F90FLAGS) $(MODFLAG) -I../../mod $(LIS_MOD) -I$(MOD_ESMF) $(*).F
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -I$(NETCDFINC) -o $(@) $(F90FLAGS) $(MODFLAG) -I../../mod $(LIS_MOD) -I$(MOD_ESMF) $<
@echo ""
ar -r ../../lib/libHYDRO.a $(@)

#
# Dependencies:
#

clean:
rm -f *.o *.mod *.stb *~
rm -f *.o *.mod *.stb *~
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
15 changes: 8 additions & 7 deletions src/CPL/NoahMP_cpl/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Makefile
# Makefile
#
.SUFFIXES:
.SUFFIXES: .o .F
Expand All @@ -11,15 +11,16 @@ MODFLAG = -I./ -I ../../MPP -I ../../mod

OBJS = \
module_hrldas_HYDRO.o \
hrldas_drv_HYDRO.o
all: $(OBJS)
hrldas_drv_HYDRO.o

.F.o:
all: $(OBJS)
ar -cr ../../lib/libHYDRO.a $(OBJS)

%.o: %.F
@echo ""
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -o $(@) $(F90FLAGS) $(LDFLAGS) $(MODFLAG) -I$(NETCDFINC) $(*).F
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -o $(@) $(F90FLAGS) $(LDFLAGS) $(MODFLAG) -I$(NETCDFINC) $<
@echo ""
ar -r ../../lib/libHYDRO.a $(@)
cp *.mod ../../mod
@cp *.mod ../../mod

#
# Dependencies:
Expand Down
13 changes: 7 additions & 6 deletions src/CPL/Noah_cpl/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Makefile
# Makefile
#
.SUFFIXES:
.SUFFIXES: .o .F
Expand All @@ -11,14 +11,15 @@ MODFLAG = -I./ -I ../../MPP -I ../../mod

OBJS = \
module_hrldas_HYDRO.o \
hrldas_drv_HYDRO.o
all: $(OBJS)
hrldas_drv_HYDRO.o

.F.o:
all: $(OBJS)
ar -r ../../lib/libHYDRO.a $(OBJS)

%.o: %.F
@echo ""
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -o $(@) $(F90FLAGS) $(MODFLAG) -I$(NETCDF_INC) $(*).F
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -o $(@) $(F90FLAGS) $(MODFLAG) -I$(NETCDF_INC) $<
@echo ""
ar -r ../../lib/libHYDRO.a $(@)

#
# Dependencies:
Expand Down
15 changes: 8 additions & 7 deletions src/CPL/WRF_cpl/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Makefile
# Makefile
#
.SUFFIXES:
.SUFFIXES: .o .F
Expand All @@ -7,19 +7,20 @@

include ../../macros

MODFLAG = -I./ -I ../../MPP -I ../../mod
MODFLAG = -I./ -I ../../MPP -I ../../mod

WRF_ROOT = ../../..
OBJS = \
module_wrf_HYDRO.o \
wrf_drv_HYDRO.o
all: $(OBJS)
wrf_drv_HYDRO.o

.F.o:
all: $(OBJS)
ar -r ../../lib/libHYDRO.a $(OBJS)

%.o: %.F
@echo ""
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -I$(NETCDFINC) -o $(@) $(F90FLAGS) $(MODFLAG) -I$(WRF_ROOT)/frame -I$(WRF_ROOT)/main -I$(WRF_ROOT)/external/esmf_time_f90 $(*).F
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -I$(NETCDFINC) -o $(@) $(F90FLAGS) $(MODFLAG) -I$(WRF_ROOT)/frame -I$(WRF_ROOT)/main -I$(WRF_ROOT)/external/esmf_time_f90 $<
@echo ""
ar -r ../../lib/libHYDRO.a $(@)

#
# Dependencies:
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)
8 changes: 4 additions & 4 deletions src/Data_Rec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ OBJS = \
module_gw_gw2d_data.o

all: $(OBJS)
ar -cr ../lib/libHYDRO.a $(OBJS)

.F.o:
%.o: %.F
@echo ""
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -I$(NETCDFINC) -o $(@) $(F90FLAGS) $(LDFLAGS) $(MODFLAG) -I../mod $(*).F
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -I$(NETCDFINC) -o $(@) $(F90FLAGS) $(LDFLAGS) $(MODFLAG) -I../mod $<
@echo ""
ar -r ../lib/libHYDRO.a $(@)
cp *.mod ../mod
@cp *.mod ../mod

# Dependencies:
#
Expand Down
14 changes: 7 additions & 7 deletions src/Debug_Utilities/Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Makefile
# Makefile
#
.SUFFIXES:
.SUFFIXES: .o .F

include ../macros

OBJS = \
debug_dump_variable.o
debug_dump_variable.o

all: $(OBJS)
all: $(OBJS)
ar -r ../lib/libHYDRO.a $(OBJS)

.F.o:
%.o: %.F
@echo ""
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -I$(NETCDFINC) -o $(@) $(F90FLAGS) $(LDFLAGS) $(MODFLAG) -I../mod $(*).F
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -I$(NETCDFINC) -o $(@) $(F90FLAGS) $(LDFLAGS) $(MODFLAG) -I../mod $<
@echo ""
ar -r ../lib/libHYDRO.a $(@)
cp *.mod ../mod
@cp *.mod ../mod

# Dependencies:
#
Expand Down
23 changes: 15 additions & 8 deletions src/HYDRO_drv/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Makefile
# Makefile
#
.SUFFIXES:
.SUFFIXES: .o .F
Expand All @@ -7,20 +7,27 @@ include ../macros

OBJS = \
module_HYDRO_drv.o
all: $(OBJS)

.F.o:
all: $(OBJS)
ar -r ../lib/libHYDRO.a $(OBJS)

%.o: %.F
@echo ""
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -o $(@) $(F90FLAGS) $(LDFLAGS) $(MODFLAG) -I$(NETCDFINC) -I../mod $(*).F
$(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -o $(@) $(F90FLAGS) $(LDFLAGS) $(MODFLAG) -I$(NETCDFINC) -I../mod $<
@echo ""
ar -r ../lib/libHYDRO.a $(@)
cp *.mod ../mod
@cp *.mod ../mod

#
# Dependencies:
#
module_HYDRO_drv.o: ../Data_Rec/module_namelist.o ../Data_Rec/module_RT_data.o ../Data_Rec/module_gw_gw2d_data.o \
../Routing/module_GW_baseflow.o ../Routing/module_HYDRO_utils.o ../Routing/module_HYDRO_io.o ../Routing/module_RT.o
module_HYDRO_drv.o: ../Data_Rec/module_namelist.o \
../Data_Rec/module_RT_data.o \
../Data_Rec/module_gw_gw2d_data.o \
../Routing/module_GW_baseflow.o \
../Routing/module_HYDRO_utils.o \
../Routing/module_HYDRO_io.o \
../Routing/module_NWM_io.o \
../Routing/module_RT.o

clean:
rm -f *.o *.mod *.stb *~
11 changes: 6 additions & 5 deletions src/IO/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Makefile
# Makefile
#
.SUFFIXES:
.SUFFIXES: .o .f90
Expand All @@ -7,17 +7,18 @@ include ../macros

OBJS = \
netcdf_layer.o

all: $(OBJS)
ar -r ../lib/libHYDRO.a $(OBJS)

.f90.o:
%.o: %.f90
@echo ""
# $(CPP) $(CPPFLAGS) -I$(NETCDFINC) $(*).F > $(*).f
# $(CPP) $(CPPFLAGS) -I$(NETCDFINC) $< > $(*).f
# $(COMPILER90) -o $(@) $(F90FLAGS) $(MODFLAG) -I../mod $(*).f
$(COMPILER90) -o $(@) $(F90FLAGS) $(LDFLAGS) $(MODFLAG) -I$(NETCDFINC) -I../mod $(*).f90
# $(RMD) $(*).f
@echo ""
ar -r ../lib/libHYDRO.a $(@)
cp *.mod ../mod
@cp *.mod ../mod

#
# Dependencies:
Expand Down
12 changes: 6 additions & 6 deletions src/Land_models/Noah/GRAPHICS/HORIZ/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SHELL=/bin/sh
.SUFFIXES:
.SUFFIXES:
.SUFFIXES: .F .o .exe
OBJS= module_plot2d_graphics.o \
module_2ddata.o \
Expand All @@ -14,8 +14,8 @@ OBJS= module_plot2d_graphics.o \
#FFLAGS=-free

F90= pgf90
FFLAGS=-Mfree
LIBS2 = -L${PGI}/linux86/5.2/lib -lpgftnrtl -lpgc
FFLAGS=-Mfree
LIBS2 = -L${PGI}/linux86/5.2/lib -lpgftnrtl -lpgc

RM = rm -f
NCARGLIBS= -L/usr/local/ncarg/lib -L/usr/X11R6/lib \
Expand All @@ -27,14 +27,14 @@ 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)

.F.o:
%.o: %.F
@echo ""
$(F90) $(CPPINVOKE) $(CPPFLAGS) -c -I$(NETCDF)/include $(FFLAGS) $(MODDIR) $(*).F
$(F90) $(CPPINVOKE) $(CPPFLAGS) -c -I$(NETCDF)/include $(FFLAGS) $(MODDIR) $<

$(CMD): $(OBJS)
$(F90) -o $(@) -I$(NETCDF)/include $(FFLAGS) $(OBJS) \
Expand Down
Loading