Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93420282
Makefile.gcc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Nov 28, 15:17
Size
3 KB
Mime Type
text/x-makefile
Expires
Sat, Nov 30, 15:17 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22632925
Attached To
R1448 Lenstool-HPC
Makefile.gcc
View Options
PROGRAM_NAME := GradientBenchmark
#CXX=g++ -lm -ffast-math -ftree-loop-vectorize
CXX=mpic++
all: $(PROGRAM_NAME)
#program_CXX_SRCS := gradient.cpp gradient_avx.cpp setup.cpp main.cpp
program_CXX_SRCS := setup.cpp main.cpp
$(warning obj files are $(program_CXX_SRCS))
#program_CXX_SRCS := $(wildcard *.cpp)
#program_CXX_SRCS += $(wildcard ../../*.cpp) #Find C++ source files from additonal directories
program_CXX_OBJS := ${program_CXX_SRCS:.cpp=.o}
$(warning obj files are $(program_CXX_OBJS))
#
program_INCLUDE_DIRS := ./
program_INCLUDE_DIRS += /users/fgilles/Projects/Libs/cfitsio/include
program_INCLUDE_DIRS += /users/fgilles/bin/iaca-lin32/include
program_INCLUDE_DIRS += /users/fgilles/Projects/lenstool-6.8.1/include
program_INCLUDE_DIRS += /users/fgilles/Projects/Libs/gsl-2.2/include
program_INCLUDE_DIRS += $(LENSTOOLHPC_ROOT)/src
program_INCLUDE_DIRS += $(LENSTOOL_ROOT)/include
program_INCLUDE_DIRS += $(GSL_ROOT)/include/
program_INCLUDE_DIRS += $(WCSTOOL_ROOT)
program_INCLUDE_DIRS += $(CFITSIO_ROOT)
#
program_INCLUDE_LIBS += $(LENSTOOLHPC_ROOT)/src
program_INCLUDE_LIBS += $(LENSTOOL_ROOT)/include
program_INCLUDE_LIBS += $(LENSTOOL_ROOT)/src
program_INCLUDE_LIBS += $(LENSTOOL_ROOT)/liblt
program_INCLUDE_LIBS += $(WCSTOOL_ROOT)
program_INCLUDE_LIBS += $(CFITSIO_ROOT)
program_INCLUDE_LIBS += $(GSL_ROOT)/lib/
#
# Compiler flags
CXXFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir))
CXXFLAGS += $(foreach includelib,$(program_INCLUDE_LIBS),-L$(includelib) -lcfitsio)
LDFLAGS := -llenstoolhpc -llenstool -llt -lgsl -lgslcblas -lm -lwcs -lcfitsio
include ../../src/cpuflags.gcc.inc
include ../../src/precision.inc
CXXFLAGS += $(PRECISION)
#CXXFLAGS += -march=xHost -fma -g -O3 -std=c++0x -Wall -pedantic
#CXXFLAGS += -qopenmp
CXXFLAGS += -D__WITH_LENSTOOL
#CXXFLAGS += -qopenmp -xHost -fma -g -O3 -std=c++0x -Wall -pedantic
#CXXFLAGS += -g -O3 -std=c++0x -Wall
#
OBJECTS = $(program_CXX_OBJS)
#
#$(warning obj files are $(OBJECTS))
#
# This is pretty ugly...details below
# The program depends on both C++ and CUDA Objects, but storing CUDA objects as .o files results in circular dependency
# warnings from Make. However, nvcc requires that object files for linking end in the .o extension, else it will throw
# an error saying that it doesn't know how to handle the file. Using a non .o rule for Make and then renaming the file
# to have the .o extension for nvcc won't suffice because the program will depend on the non .o file but the files in
# the directory after compilation will have a .o suffix. Thus, when one goes to recompile the code all files will be
# recompiled instead of just the ones that have been updated.
#
# The solution below solves these issues by silently converting the non .o suffix needed by make to the .o suffix
# required by nvcc, calling nvcc, and then converting back to the non .o suffix for future, dependency-based
# compilation.
#
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $<
#
$(PROGRAM_NAME): $(program_CXX_OBJS)
$(CXX) $(CXXFLAGS) -o $@ $(OBJECTS) $(LDFLAGS)
#
#
.PHONY: all clean distclean
#
clean:
@- $(RM) $(PROGRAM_NAME) $(OBJECTS) *~ *.o *.optrpt
#
distclean: clean
Event Timeline
Log In to Comment