From 74ec3ec651b6e37a451f44a0393377e73779247c Mon Sep 17 00:00:00 2001 From: cjknight Date: Mon, 4 Nov 2024 21:55:20 -0600 Subject: [PATCH] include Makefile --- gpu/mini-apps/math/Makefile | 83 +++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 gpu/mini-apps/math/Makefile diff --git a/gpu/mini-apps/math/Makefile b/gpu/mini-apps/math/Makefile new file mode 100644 index 00000000..d0f723ad --- /dev/null +++ b/gpu/mini-apps/math/Makefile @@ -0,0 +1,83 @@ +# +# Definition of MACROS + +BASE_LIBGPU=../../src + +BINROOT=./ +EXE=a.out +SHELL=/bin/sh +CXX = g++ +CXXFLAGS= +FC=gfortran +FCFLAGS= +LD = g++ +LDFLAGS = -fPIC -shared +AR = ar rcs +CPP=cpp -P -traditional +INSTALL=../ + +ARCH ?= polaris +include $(BASE_LIBGPU)/arch/$(ARCH) + +CXXFLAGS += -I$(BASE_LIBGPU) + +$(info ARCH is [${ARCH}]) + +CSRC = $(wildcard *.cpp) +INC = $(wildcard *.h) +COBJ = $(CSRC:.cpp=.o) + +FSRC = $(wildcard *.F90) +MOD = $(FSRC:.F90=.mod) +FOBJ = $(FSRC:.F90=.o) + +#$(info CSRC is [${CSRC}]) +#$(info INC is [${INC}]) +#$(info COBJ is [${COBJ}]) + +#$(info FSRC is [${FSRC}]) +#$(info MOD is [${MOD}]) +#$(info FOBJ is [${FOBJ}]) + +# +# -- target : Dependencies +# -- Rule to create target + +$(EXE): $(COBJ) $(FOBJ) $(MOD) + $(LD) $(LDFLAGS) -o $@ $(COBJ) $(LIB) + +install: $(EXE) + cp $(EXE) $(INSTALL) +# cp $(MOD) $(FOBJ) $(INSTALL)/include + +pm: + cp ../../src/pm*.cpp ./ + +#################################################################### + +$(COBJ): %.o: %.cpp + $(CXX) $(CXXFLAGS) -c $< + +$(FOBJ): %.o: %.F90 + $(FC) $(FCFLAGS) -c $< + +$(MOD): %.mod: %.F90 + $(FC) $(FCFLAGS) -c $< + +# +# -- Remove *.o and *~ from the directory +clean: + rm -f *.o *.mod *~ $(EXE) + rm -f $(INSTALL)/$(EXE) + rm -rf $(EXE).dSYM +# +# -- Remove *.o, *~, and executable from the directory +realclean: + rm -f *.o *.mod *~ $(EXE) + rm -f $(INSTALL)/$(EXE) + rm -rf $(EXE).dSYM + rm -f *.optrpt + rm -f pm*.cpp + +# +# -- Simple dependencies