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

Rework makefiles to allow selection of CC/CXX #68

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Prev Previous commit
Next Next commit
Get rid of hard-coded CXX and LD variables, and some hardcoded g++ ca…
…lls.
pigrew committed Apr 23, 2018
commit 4cc2b428dccdde02e2c5f3ae611ec6ba2792b130
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -143,7 +143,7 @@ no_opencl_support:
@echo "Warning: gpgpu-sim is building without opencl support. Make sure NVOPENCL_LIBDIR and NVOPENCL_INCDIR are set"

$(SIM_LIB_DIR)/libcudart.so: makedirs $(LIBS) cudalib
g++ -shared -Wl,-soname,libcudart_$(GPGPUSIM_BUILD).so -Wl,--version-script=linux-so-version.txt\
$(CXX) $(LDFLAGS) -shared -Wl,-soname,libcudart_$(GPGPUSIM_BUILD).so -Wl,--version-script=linux-so-version.txt \
$(SIM_OBJ_FILES_DIR)/libcuda/*.o \
$(SIM_OBJ_FILES_DIR)/cuda-sim/*.o \
$(SIM_OBJ_FILES_DIR)/cuda-sim/decuda_pred_table/*.o \
@@ -165,7 +165,7 @@ $(SIM_LIB_DIR)/libcudart.so: makedirs $(LIBS) cudalib
if [ ! -f $(SIM_LIB_DIR)/libcudart.so.9.1 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.9.1; fi

$(SIM_LIB_DIR)/libcudart.dylib: makedirs $(LIBS) cudalib
g++ -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1.1,-current_version,1.1\
$(CXX) -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1.1,-current_version,1.1\
$(SIM_OBJ_FILES_DIR)/libcuda/*.o \
$(SIM_OBJ_FILES_DIR)/cuda-sim/*.o \
$(SIM_OBJ_FILES_DIR)/cuda-sim/decuda_pred_table/*.o \
@@ -176,7 +176,7 @@ $(SIM_LIB_DIR)/libcudart.dylib: makedirs $(LIBS) cudalib
-o $(SIM_LIB_DIR)/libcudart.dylib

$(SIM_LIB_DIR)/libOpenCL.so: makedirs $(LIBS) opencllib
g++ -shared -Wl,-soname,libOpenCL_$(GPGPUSIM_BUILD).so \
$(CXX) -shared -Wl,-soname,libOpenCL_$(GPGPUSIM_BUILD).so \
$(SIM_OBJ_FILES_DIR)/libopencl/*.o \
$(SIM_OBJ_FILES_DIR)/cuda-sim/*.o \
$(SIM_OBJ_FILES_DIR)/cuda-sim/decuda_pred_table/*.o \
2 changes: 0 additions & 2 deletions cuobjdump_to_ptxplus/Makefile
Original file line number Diff line number Diff line change
@@ -3,9 +3,7 @@ LEXFLAGS = -B
YACC = bison
YFLAGS = -t -d --report=all --verbose
CCFLAGS = -ggdb -fPIC -Wall -Wno-unused-function -Wno-sign-compare
CXX = g++
CXXFLAGS = ${CCFLAGS}
LD = g++
LDFLAGS = ${CCFLAGS}
OUTPUT_DIR=$(SIM_OBJ_FILES_DIR)/cuobjdump_to_ptxplus

4 changes: 1 addition & 3 deletions libcuda/Makefile
Original file line number Diff line number Diff line change
@@ -71,8 +71,6 @@ ifeq ($(GNUC_CPP0X), 1)
endif


CPP = g++ $(SNOW)
CC = gcc $(SNOW)
CREATELIBRARY = 1
DEBUG ?= 0
ifeq ($(DEBUG),1)
@@ -108,7 +106,7 @@ lib$(PROG).a: $(OBJS)
ar rcs $(OUTPUT_DIR)/lib$(PROG).a $(OBJS)

$(OUTPUT_DIR)/%.o: %.cc
$(CPP) $(CXXFLAGS) -I./ -I$(OUTPUT_DIR) -I$(CUDA_INSTALL_PATH)/include -c $< -o $@
$(CXX) $(CXXFLAGS) -I./ -I$(OUTPUT_DIR) -I$(CUDA_INSTALL_PATH)/include -c $< -o $@

$(OUTPUT_DIR)/%.o: %.c
$(CC) $(CCFLAGS) -I./ -I$(OUTPUT_DIR) -I$(CUDA_INSTALL_PATH)/include -c $< -o $@
6 changes: 2 additions & 4 deletions libopencl/Makefile
Original file line number Diff line number Diff line change
@@ -66,8 +66,6 @@ ifeq ($(OPENGL_SUPPORT),1)
GL = -DOPENGL_SUPPORT
endif

CPP = g++
CC = gcc
CREATELIBRARY = 1
DEBUG ?= 0
CCFLAGS = -O3 -g -Wall -fPIC $(GL)
@@ -106,11 +104,11 @@ depend:

$(OUTPUT_DIR)/nvopencl_wrapper: nvopencl_wrapper.cc
if [ ! -d bin ]; then mkdir bin; fi
g++ $(CCFLAGS) nvopencl_wrapper.cc -I./ -I$(NVOPENCL_INCDIR)/ -L $(NVOPENCL_LIBDIR) -lOpenCL -o $(OUTPUT_DIR)/bin/nvopencl_wrapper
$(CXX) $(CCFLAGS) nvopencl_wrapper.cc -I./ -I$(NVOPENCL_INCDIR)/ -L $(NVOPENCL_LIBDIR) -lOpenCL -o $(OUTPUT_DIR)/bin/nvopencl_wrapper


$(OUTPUT_DIR)/%.o: %.cc
$(CPP) $(CCFLAGS) -I./ -I$(CUDA_INSTALL_PATH)/include -c $< -o $@
$(CXX) $(CCFLAGS) -I./ -I$(CUDA_INSTALL_PATH)/include -c $< -o $@

clean:
rm -f $(PROG)
3 changes: 1 addition & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -53,7 +53,6 @@ endif

OPTFLAGS += -g3 -fPIC

CPP = g++ $(SNOW)
OEXT = o

OUTPUT_DIR=$(SIM_OBJ_FILES_DIR)
@@ -76,7 +75,7 @@ clean:
rm -f *.o core *~ *.a Makefile.makedepend Makefile.makedepend.bak

$(OUTPUT_DIR)/%.$(OEXT): %.cc
$(CPP) $(OPTFLAGS) $(CXXFLAGS) -o $(OUTPUT_DIR)/$*.$(OEXT) -c $*.cc
$(CXX) $(OPTFLAGS) $(CXXFLAGS) -o $(OUTPUT_DIR)/$*.$(OEXT) -c $*.cc

option_parser.$(OEXT): option_parser.h

9 changes: 4 additions & 5 deletions src/cuda-sim/Makefile
Original file line number Diff line number Diff line change
@@ -32,7 +32,6 @@ INTEL=0
DEBUG?=0
TRACE?=0

CPP = g++ $(SNOW)
ifeq ($(INTEL),1)
CPP = icpc
CC = icc
@@ -79,16 +78,16 @@ libgpgpu_ptx_sim.a: $(OBJS)
ar rcs $(OUTPUT_DIR)/libgpgpu_ptx_sim.a $(OUTPUT_DIR)/ptx.tab.o $(OUTPUT_DIR)/lex.ptx_.o $(OUTPUT_DIR)/ptxinfo.tab.o $(OUTPUT_DIR)/lex.ptxinfo_.o $(OBJS)

$(OUTPUT_DIR)/ptx.tab.o: $(OUTPUT_DIR)/ptx.tab.c
$(CPP) -c $(OPT) -DYYDEBUG $(OUTPUT_DIR)/ptx.tab.c -o $(OUTPUT_DIR)/ptx.tab.o
$(CXX) -c $(OPT) -DYYDEBUG $(OUTPUT_DIR)/ptx.tab.c -o $(OUTPUT_DIR)/ptx.tab.o

$(OUTPUT_DIR)/lex.ptx_.o: $(OUTPUT_DIR)/lex.ptx_.c
$(CPP) -c $(OPT) $(OUTPUT_DIR)/lex.ptx_.c -o $(OUTPUT_DIR)/lex.ptx_.o
$(CXX) -c $(OPT) $(OUTPUT_DIR)/lex.ptx_.c -o $(OUTPUT_DIR)/lex.ptx_.o

$(OUTPUT_DIR)/ptxinfo.tab.o: $(OUTPUT_DIR)/ptxinfo.tab.c
$(CPP) -c $(OPT) -DYYDEBUG $(OUTPUT_DIR)/ptxinfo.tab.c -o $(OUTPUT_DIR)/ptxinfo.tab.o
$(CXX) -c $(OPT) -DYYDEBUG $(OUTPUT_DIR)/ptxinfo.tab.c -o $(OUTPUT_DIR)/ptxinfo.tab.o

$(OUTPUT_DIR)/lex.ptxinfo_.o: $(OUTPUT_DIR)/lex.ptxinfo_.c $(OUTPUT_DIR)/ptxinfo.tab.c
$(CPP) -c $(OPT) $(OUTPUT_DIR)/lex.ptxinfo_.c -o $(OUTPUT_DIR)/lex.ptxinfo_.o
$(CXX) -c $(OPT) $(OUTPUT_DIR)/lex.ptxinfo_.c -o $(OUTPUT_DIR)/lex.ptxinfo_.o

$(OUTPUT_DIR)/ptx.tab.c: ptx.y
bison --name-prefix=ptx_ -v -d ptx.y --file-prefix=$(OUTPUT_DIR)/ptx
3 changes: 1 addition & 2 deletions src/gpgpu-sim/Makefile
Original file line number Diff line number Diff line change
@@ -61,7 +61,6 @@ endif
OPTFLAGS += -g3 -fPIC
OPTFLAGS += -DCUDART_VERSION=$(CUDART_VERSION)

CPP = g++ $(SNOW)
OEXT = o

OUTPUT_DIR=$(SIM_OBJ_FILES_DIR)/gpgpu-sim
@@ -88,7 +87,7 @@ depend:
makedepend -f$(OUTPUT_DIR)/Makefile.makedepend -p$(OUTPUT_DIR)/ $(CSRCS) 2> /dev/null

$(OUTPUT_DIR)/%.$(OEXT): %.cc
$(CPP) $(OPTFLAGS) $(CXXFLAGS) $(POWER_FLAGS) -o $(OUTPUT_DIR)/$*.$(OEXT) -c $*.cc
$(CXX) $(OPTFLAGS) $(CXXFLAGS) $(POWER_FLAGS) -o $(OUTPUT_DIR)/$*.$(OEXT) -c $*.cc

clean:
rm -f *.o core *~ *.a
2 changes: 0 additions & 2 deletions src/intersim2/Makefile
Original file line number Diff line number Diff line change
@@ -27,8 +27,6 @@
#
# Makefile
#
CXX = g++
CC = gcc
CREATE_LIBRARY ?= 0
INTERFACE = interconnect_interface.cpp
DEBUG ?= 0