summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Rogers <[email protected]>2013-06-25 13:19:58 -0800
committerAndrew Boktor <[email protected]>2014-08-14 13:50:57 -0700
commit5d69aa95a9ea9ac326c34c4842b87e8123a77186 (patch)
treebd10eeda9dd131eca900ab410c692bfaea1855dd
parentb84f4193f7e94c503cfd07cdcdb8b6951400f695 (diff)
Changing the make flow so all the generated files, both object and code generated go in a directory independent of the source directory
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 16503]
-rw-r--r--CHANGES2
-rw-r--r--Makefile56
-rw-r--r--cuobjdump_to_ptxplus/Makefile12
-rw-r--r--libcuda/Makefile10
-rw-r--r--libopencl/Makefile19
-rw-r--r--setup_environment8
-rw-r--r--src/Makefile16
-rw-r--r--src/cuda-sim/Makefile82
-rw-r--r--src/gpgpu-sim/Makefile16
-rw-r--r--src/gpuwattch/cacti/cacti.mk21
-rw-r--r--src/gpuwattch/mcpat.mk19
-rw-r--r--src/intersim/Makefile46
12 files changed, 151 insertions, 156 deletions
diff --git a/CHANGES b/CHANGES
index 0f41234..cbc929b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -23,6 +23,8 @@ Version 3.2.1+edits (development branch) versus 3.2.1
simulation liveness messages printed by the timing model (defaults to
1 message per second in wall clock time).
- Added breakdown for interconnection traffic based on memory access type.
+- Changes to the makefiles s.t. all intermediate files get output to the build
+ directory, and nothing is written to the same directory as the source code
- Bug Fixes:
- Fixed the flit count sent to GPUWattch for atomic operations.
- Fix for Bug 51 - Updated the function declaration of
diff --git a/Makefile b/Makefile
index 7a9c9bd..9bf8f83 100644
--- a/Makefile
+++ b/Makefile
@@ -31,22 +31,23 @@
include version_detection.mk
-ifeq ($(GPGPUSIM_CONFIG), $(CUDART_VERSION)/debug)
+ifeq ($(GPGPUSIM_CONFIG), gcc-$(CC_VERSION)/cuda-$(CUDART_VERSION)/debug)
export DEBUG=1
else
export DEBUG=0
endif
+BUILD_ROOT?=$(shell pwd)
export TRACE?=1
NVCC_PATH=$(shellwhich nvcc)
ifneq ($(shell which nvcc), "")
ifeq ($(DEBUG), 1)
- export SIM_LIB_DIR=lib/$(CUDART_VERSION)/debug
- export SIM_OBJ_FILES_DIR=build/$(CUDART_VERSION)/debug
+ export SIM_LIB_DIR=lib/gcc-$(CC_VERSION)/cuda-$(CUDART_VERSION)/debug
+ export SIM_OBJ_FILES_DIR=$(BUILD_ROOT)/build/gcc-$(CC_VERSION)/cuda-$(CUDART_VERSION)/debug
else
- export SIM_LIB_DIR=lib/$(CUDART_VERSION)/release
- export SIM_OBJ_FILES_DIR=build/$(CUDART_VERSION)/release
+ export SIM_LIB_DIR=lib/gcc-$(CC_VERSION)/cuda-$(CUDART_VERSION)/release
+ export SIM_OBJ_FILES_DIR=$(BUILD_ROOT)/build/gcc-$(CC_VERSION)/cuda-$(CUDART_VERSION)/release
endif
endif
@@ -77,12 +78,11 @@ ifneq ($(GPGPUSIM_POWER_MODEL),)
ifeq ($(DEBUG), 1)
- MCPAT_OBJ_DIR = $(GPGPUSIM_POWER_MODEL)/obj_dbg
MCPAT_DBG_FLAG = dbg
- else
- MCPAT_OBJ_DIR = $(GPGPUSIM_POWER_MODEL)/obj_opt
endif
+ MCPAT_OBJ_DIR = $(SIM_OBJ_FILES_DIR)/gpuwattch
+
MCPAT = $(MCPAT_OBJ_DIR)/*.o
endif
@@ -136,7 +136,7 @@ check_power:
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: $(LIBS) cudalib
+$(SIM_LIB_DIR)/libcudart.so: makedirs $(LIBS) cudalib
g++ -shared -Wl,-soname,libcudart.so \
$(SIM_OBJ_FILES_DIR)/libcuda/*.o \
$(SIM_OBJ_FILES_DIR)/cuda-sim/*.o \
@@ -150,7 +150,7 @@ $(SIM_LIB_DIR)/libcudart.so: $(LIBS) cudalib
if [ ! -f $(SIM_LIB_DIR)/libcudart.so.3 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.3; fi
if [ ! -f $(SIM_LIB_DIR)/libcudart.so.4 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.4; fi
-$(SIM_LIB_DIR)/libcudart.dylib: $(LIBS) cudalib
+$(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\
$(SIM_OBJ_FILES_DIR)/libcuda/*.o \
$(SIM_OBJ_FILES_DIR)/cuda-sim/*.o \
@@ -161,7 +161,7 @@ $(SIM_LIB_DIR)/libcudart.dylib: $(LIBS) cudalib
$(MCPAT) \
-o $(SIM_LIB_DIR)/libcudart.dylib
-$(SIM_LIB_DIR)/libOpenCL.so: $(LIBS) opencllib
+$(SIM_LIB_DIR)/libOpenCL.so: makedirs $(LIBS) opencllib
g++ -shared -Wl,-soname,libOpenCL.so \
$(SIM_OBJ_FILES_DIR)/libopencl/*.o \
$(SIM_OBJ_FILES_DIR)/cuda-sim/*.o \
@@ -174,37 +174,37 @@ $(SIM_LIB_DIR)/libOpenCL.so: $(LIBS) opencllib
if [ ! -f $(SIM_LIB_DIR)/libOpenCL.so.1 ]; then ln -s libOpenCL.so $(SIM_LIB_DIR)/libOpenCL.so.1; fi
if [ ! -f $(SIM_LIB_DIR)/libOpenCL.so.1.1 ]; then ln -s libOpenCL.so $(SIM_LIB_DIR)/libOpenCL.so.1.1; fi
-cudalib: cuda-sim
+cudalib: makedirs cuda-sim
$(MAKE) -C ./libcuda/ depend
$(MAKE) -C ./libcuda/
ifneq ($(GPGPUSIM_POWER_MODEL),)
-mcpat:
+mcpat: makedirs
$(MAKE) -C $(GPGPUSIM_POWER_MODEL) depend
$(MAKE) -C $(GPGPUSIM_POWER_MODEL) $(MCPAT_DBG_FLAG)
endif
-cuda-sim:
+cuda-sim: makedirs
$(MAKE) -C ./src/cuda-sim/ depend
$(MAKE) -C ./src/cuda-sim/
-gpgpu-sim_uarch: cuda-sim
+gpgpu-sim_uarch: makedirs cuda-sim
$(MAKE) -C ./src/gpgpu-sim/ depend
$(MAKE) -C ./src/gpgpu-sim/
-intersim: cuda-sim gpgpu-sim_uarch
+intersim: makedirs cuda-sim gpgpu-sim_uarch
$(MAKE) "CREATELIBRARY=1" "DEBUG=$(DEBUG)" -C ./src/intersim
-gpgpusimlib: cuda-sim gpgpu-sim_uarch intersim
+gpgpusimlib: makedirs cuda-sim gpgpu-sim_uarch intersim
$(MAKE) -C ./src/ depend
$(MAKE) -C ./src/
-opencllib: cuda-sim
+opencllib: makedirs cuda-sim
$(MAKE) -C ./libopencl/ depend
$(MAKE) -C ./libopencl/
.PHONY: cuobjdump_to_ptxplus/cuobjdump_to_ptxplus
-cuobjdump_to_ptxplus/cuobjdump_to_ptxplus:
+cuobjdump_to_ptxplus/cuobjdump_to_ptxplus: makedirs
$(MAKE) -C ./cuobjdump_to_ptxplus/ depend
$(MAKE) -C ./cuobjdump_to_ptxplus/
@@ -215,9 +215,11 @@ makedirs:
if [ ! -d $(SIM_OBJ_FILES_DIR)/cuda-sim/decuda_pred_table ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/cuda-sim/decuda_pred_table; fi;
if [ ! -d $(SIM_OBJ_FILES_DIR)/gpgpu-sim ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/gpgpu-sim; fi;
if [ ! -d $(SIM_OBJ_FILES_DIR)/libopencl ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/libopencl; fi;
+ if [ ! -d $(SIM_OBJ_FILES_DIR)/libopencl/bin ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/libopencl/bin; fi;
if [ ! -d $(SIM_OBJ_FILES_DIR)/intersim ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/intersim; fi;
if [ ! -d $(SIM_OBJ_FILES_DIR)/cuobjdump_to_ptxplus ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/cuobjdump_to_ptxplus; fi;
- if [ ! -d $(GPGPUSIM_POWER_MODEL)/obj_opt ] && [ ! -n $(GPGPUSIM_POWER_MODEL) ]; then mkdir -p $(GPGPUSIM_POWER_MODEL)/obj_opt; fi;
+ if [ ! -d $(SIM_OBJ_FILES_DIR)/gpuwattch ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/gpuwattch; fi;
+ if [ ! -d $(SIM_OBJ_FILES_DIR)/gpuwattch/cacti ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/gpuwattch/cacti; fi;
all:
$(MAKE) gpgpusim
@@ -228,21 +230,9 @@ docs:
cleandocs:
$(MAKE) clean -C doc/doxygen/
-clean:
+clean: makedirs
$(MAKE) cleangpgpusim
cleangpgpusim: cleandocs
- $(MAKE) clean -C ./libcuda/
-ifneq ($(NVOPENCL_LIBDIR),)
- $(MAKE) clean -C ./libopencl/
-endif
- $(MAKE) clean -C ./src/intersim/
- $(MAKE) clean -C ./src/cuda-sim/
- $(MAKE) clean -C ./src/gpgpu-sim/
- $(MAKE) clean -C ./src/
- $(MAKE) clean -C ./cuobjdump_to_ptxplus/
-ifneq ($(GPGPUSIM_POWER_MODEL),)
- $(MAKE) clean -C $(GPGPUSIM_POWER_MODEL)
-endif
rm -rf $(SIM_LIB_DIR)
rm -rf $(SIM_OBJ_FILES_DIR)
diff --git a/cuobjdump_to_ptxplus/Makefile b/cuobjdump_to_ptxplus/Makefile
index 14fcc68..40b8b48 100644
--- a/cuobjdump_to_ptxplus/Makefile
+++ b/cuobjdump_to_ptxplus/Makefile
@@ -7,7 +7,7 @@ CXX = g++
CXXFLAGS = ${CCFLAGS}
LD = g++
LDFLAGS = ${CCFLAGS}
-OUTPUT_DIR=../$(SIM_OBJ_FILES_DIR)/cuobjdump_to_ptxplus
+OUTPUT_DIR=$(SIM_OBJ_FILES_DIR)/cuobjdump_to_ptxplus
CXXFLAGS += -I $(OUTPUT_DIR) -I . -I ../src/cuda-sim/
@@ -64,11 +64,11 @@ $(OUTPUT_DIR)/%.o: %.c %.h
SRCS = $(shell ls *.cc)
-Makefile.makedepend: depend
+$(OUTPUT_DIR)/Makefile.makedepend: depend
depend:
- touch Makefile.makedepend
- makedepend -fMakefile.makedepend $(SRCS) 2> /dev/null
+ touch $(OUTPUT_DIR)/Makefile.makedepend
+ makedepend -f$(OUTPUT_DIR)/Makefile.makedepend $(SRCS) 2> /dev/null
clean:
rm -f lex.ptx_.c ptx.tab.c ptx.tab.h ptx.output
@@ -76,7 +76,7 @@ clean:
rm -f sass_lexer.cc sass_parser.cc sass_parser.hh sass_parser.output
rm -f header_lexer.cc header_parser.cc header_parser.hh header_parser.output
rm -rf $(OUTPUT_DIR)
- rm -f Makefile.makedepend Makefile.makedepend.bak
+ rm -f $(OUTPUT_DIR)/Makefile.makedepend $(OUTPUT_DIR)/Makefile.makedepend.bak
-include Makefile.makedepend
+include $(OUTPUT_DIR)/Makefile.makedepend
diff --git a/libcuda/Makefile b/libcuda/Makefile
index 399a533..b1a6552 100644
--- a/libcuda/Makefile
+++ b/libcuda/Makefile
@@ -96,7 +96,7 @@ YFLAGS = -t -d -v --report=all
.PHONY: clean
-OUTPUT_DIR=../$(SIM_OBJ_FILES_DIR)/libcuda
+OUTPUT_DIR=$(SIM_OBJ_FILES_DIR)/libcuda
OBJS = $(CXX_SRCS:%.cc=$(OUTPUT_DIR)/%.o)
OBJS += $(LEX_SRCS:%.l=$(OUTPUT_DIR)/%_lexer.o)
@@ -123,11 +123,11 @@ cuobjdump_lexer.c: cuobjdump.l cuobjdump_parser.h
# in other words, get parser.c and do nothing to get parser.h
%_parser.h: %_parser.c
:
-Makefile.makedepend: depend
+$(OUTPUT_DIR)/Makefile.makedepend: depend
depend:
- touch Makefile.makedepend
- makedepend -fMakefile.makedepend -p$(OUTPUT_DIR)/ $(CXX_SRCS) 2> /dev/null
+ touch $(OUTPUT_DIR)/Makefile.makedepend
+ makedepend -f$(OUTPUT_DIR)/Makefile.makedepend -p$(OUTPUT_DIR)/ $(CXX_SRCS) 2> /dev/null
clean:
rm -f $(PROG)
@@ -137,5 +137,5 @@ clean:
rm -f *_lexer.*
rm -f Makefile.makedepend Makefile.makedepend.bak
-include Makefile.makedepend
+include $(OUTPUT_DIR)/Makefile.makedepend
diff --git a/libopencl/Makefile b/libopencl/Makefile
index d597a0d..f849225 100644
--- a/libopencl/Makefile
+++ b/libopencl/Makefile
@@ -87,28 +87,27 @@ CCFLAGS += -DCUDART_VERSION=$(CUDART_VERSION)
.PHONY: clean
-OUTPUT_DIR=../$(SIM_OBJ_FILES_DIR)/libopencl
+OUTPUT_DIR=$(SIM_OBJ_FILES_DIR)/libopencl
OBJS = $(CXX_SRCS:%.cc=$(OUTPUT_DIR)/%.o)
#--- Make rules ---
-all: lib$(PROG).a nvopencl_wrapper
+all: lib$(PROG).a $(OUTPUT_DIR)/nvopencl_wrapper
lib$(PROG).a: $(OBJS)
ar rcs $(OUTPUT_DIR)/lib$(PROG).a $(OBJS)
-Makefile.makedepend: depend
+$(OUTPUT_DIR)/Makefile.makedepend: depend
depend:
- touch Makefile.makedepend
- makedepend -fMakefile.makedepend -p$(OUTPUT_DIR)/ $(CXX_SRCS) 2> /dev/null
+ touch $(OUTPUT_DIR)/Makefile.makedepend
+ makedepend -f$(OUTPUT_DIR)/Makefile.makedepend -p$(OUTPUT_DIR)/ $(CXX_SRCS) 2> /dev/null
-nvopencl_wrapper: nvopencl_wrapper.cc
+$(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 bin/nvopencl_wrapper
+ g++ $(CCFLAGS) nvopencl_wrapper.cc -I./ -I$(NVOPENCL_INCDIR)/ -L $(NVOPENCL_LIBDIR) -lOpenCL -o $(OUTPUT_DIR)/bin/nvopencl_wrapper
-OUTPUT_DIR=../$(SIM_OBJ_FILES_DIR)/libopencl
$(OUTPUT_DIR)/%.o: %.cc
$(CPP) $(CCFLAGS) -I./ -I$(CUDA_INSTALL_PATH)/include -c $< -o $@
@@ -118,7 +117,7 @@ clean:
rm -f *.o
rm -f lib$(PROG).a
rm -f bin/nvopencl_wrapper
- rm -f Makefile.makedepend Makefile.makedepend.bak
+ rm -f $(OUTPUT_DIR)/Makefile.makedepend $(OUTPUT_DIR)/Makefile.makedepend.bak
-include Makefile.makedepend
+include $(OUTPUT_DIR)/Makefile.makedepend
diff --git a/setup_environment b/setup_environment
index cb39553..b4bcd1b 100644
--- a/setup_environment
+++ b/setup_environment
@@ -1,6 +1,6 @@
# see README before running this
-ps -p $$ | awk '/bash/ {exit 1;}' && echo "ERROR ** source setup_environment must be run in a bash shell; see README" && exit
+ps -p $$ | awk '/bash/ || / sh/ {exit 1;}' && echo "ERROR ** source setup_environment must be run in a bash or sh shell; see README" && exit
export GPGPUSIM_SETUP_ENVIRONMENT_WAS_RUN=
export GPGPUSIM_ROOT="$( cd "$( dirname "$BASH_SOURCE" )" && pwd )"
@@ -39,6 +39,8 @@ if [ $? = 1 ]; then
return;
fi
+CC_VERSION=`gcc --version | head -1 | sed -re "s/gcc\s+\(.*\)\s+([0-9.]+)/\1/"`
+
CUDA_VERSION_STRING=`$CUDA_INSTALL_PATH/bin/nvcc --version | awk '/release/ {print $5;}' | sed 's/,//'`;
CUDA_VERSION_NUMBER=`echo $CUDA_VERSION_STRING | sed 's/\./ /' | awk '{printf("%02u%02u", 10*int($1), 10*$2);}'`
if [ $CUDA_VERSION_NUMBER -gt 4020 -o $CUDA_VERSION_NUMBER -lt 2030 ]; then
@@ -48,9 +50,9 @@ fi
if [ $# == '1' ] ;
then
- export GPGPUSIM_CONFIG=$CUDA_VERSION_NUMBER/$1
+ export GPGPUSIM_CONFIG=gcc-$CC_VERSION/cuda-$CUDA_VERSION_NUMBER/$1
else
- export GPGPUSIM_CONFIG=$CUDA_VERSION_NUMBER/release
+ export GPGPUSIM_CONFIG=gcc-$CC_VERSION/cuda-$CUDA_VERSION_NUMBER/release
fi
export QTINC=/usr/include
diff --git a/src/Makefile b/src/Makefile
index cc31764..6001669 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -56,7 +56,7 @@ OPTFLAGS += -g3 -fPIC
CPP = g++ $(SNOW)
OEXT = o
-OUTPUT_DIR=../$(SIM_OBJ_FILES_DIR)
+OUTPUT_DIR=$(SIM_OBJ_FILES_DIR)
SRCS = $(shell ls *.cc)
OBJS = $(SRCS:%.cc=$(OUTPUT_DIR)/%.$(OEXT))
@@ -66,19 +66,19 @@ $(OUTPUT_DIR)/libgpgpusim.a: $(OBJS) gpu_uarch_simlib
gpu_uarch_simlib:
make -C ./gpgpu-sim
-Makefile.makedepend: depend
+$(OUTPUT_DIR)/Makefile.makedepend: depend
depend:
- touch Makefile.makedepend
- makedepend -fMakefile.makedepend -p$(OUTPUT_DIR)/ $(SRCS) 2> /dev/null
-
-$(OUTPUT_DIR)/%.$(OEXT): %.cc
- $(CPP) $(OPTFLAGS) $(CXXFLAGS) -o $(OUTPUT_DIR)/$*.$(OEXT) -c $*.cc
+ touch $(OUTPUT_DIR)/Makefile.makedepend
+ makedepend -f$(OUTPUT_DIR)/Makefile.makedepend -p$(OUTPUT_DIR)/ $(SRCS) 2> /dev/null
clean:
rm -f *.o core *~ *.a Makefile.makedepend Makefile.makedepend.bak
+$(OUTPUT_DIR)/%.$(OEXT): %.cc
+ $(CPP) $(OPTFLAGS) $(CXXFLAGS) -o $(OUTPUT_DIR)/$*.$(OEXT) -c $*.cc
+
option_parser.$(OEXT): option_parser.h
-include Makefile.makedepend
+include $(OUTPUT_DIR)/Makefile.makedepend
diff --git a/src/cuda-sim/Makefile b/src/cuda-sim/Makefile
index 51a9d8e..166e256 100644
--- a/src/cuda-sim/Makefile
+++ b/src/cuda-sim/Makefile
@@ -40,11 +40,13 @@ endif
include ../../version_detection.mk
+OUTPUT_DIR=$(SIM_OBJ_FILES_DIR)/cuda-sim
+
OPT := -O3 -g3 -Wall -Wno-unused-function -Wno-sign-compare
ifeq ($(DEBUG),1)
OPT := -g3 -Wall -Wno-unused-function -Wno-sign-compare
endif
-OPT += -I$(CUDA_INSTALL_PATH)/include
+OPT += -I$(CUDA_INSTALL_PATH)/include -I$(OUTPUT_DIR)/ -I.
OPT += -fPIC
ifeq ($(TRACE),1)
@@ -60,8 +62,6 @@ ifeq ($(GNUC_CPP0X),1)
endif
endif
-OUTPUT_DIR=../../$(SIM_OBJ_FILES_DIR)/cuda-sim
-
OBJS := $(OUTPUT_DIR)/ptx_parser.o $(OUTPUT_DIR)/ptx_loader.o $(OUTPUT_DIR)/cuda_device_printf.o $(OUTPUT_DIR)/instructions.o $(OUTPUT_DIR)/cuda-sim.o $(OUTPUT_DIR)/ptx_ir.o $(OUTPUT_DIR)/ptx_sim.o $(OUTPUT_DIR)/memory.o $(OUTPUT_DIR)/ptx-stats.o $(OUTPUT_DIR)/decuda_pred_table/decuda_pred_table.o $(OUTPUT_DIR)/ptx.tab.o $(OUTPUT_DIR)/lex.ptx_.o $(OUTPUT_DIR)/ptxinfo.tab.o $(OUTPUT_DIR)/lex.ptxinfo_.o
@@ -69,53 +69,53 @@ OPT += -DCUDART_VERSION=$(CUDART_VERSION)
SRCS = $(shell ls *.cc)
-Makefile.makedepend: depend
+$(OUTPUT_DIR)/Makefile.makedepend: depend
depend:
- touch Makefile.makedepend
- makedepend -fMakefile.makedepend -p$(OUTPUT_DIR)/ $(SRCS) 2> /dev/null
+ touch $(OUTPUT_DIR)/Makefile.makedepend
+ makedepend -f$(OUTPUT_DIR)/Makefile.makedepend -p$(OUTPUT_DIR)/ $(SRCS) 2> /dev/null
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: ptx.tab.c
- $(CPP) -c $(OPT) -DYYDEBUG ptx.tab.c -o $(OUTPUT_DIR)/ptx.tab.o
+$(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
-$(OUTPUT_DIR)/lex.ptx_.o: lex.ptx_.c
- $(CPP) -c $(OPT) lex.ptx_.c -o $(OUTPUT_DIR)/lex.ptx_.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
-$(OUTPUT_DIR)/ptxinfo.tab.o: ptxinfo.tab.c
- $(CPP) -c $(OPT) -DYYDEBUG ptxinfo.tab.c -o $(OUTPUT_DIR)/ptxinfo.tab.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
-$(OUTPUT_DIR)/lex.ptxinfo_.o: lex.ptxinfo_.c ptxinfo.tab.c
- $(CPP) -c $(OPT) lex.ptxinfo_.c -o $(OUTPUT_DIR)/lex.ptxinfo_.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
-ptx.tab.c: ptx.y
- bison --name-prefix=ptx_ -v -d ptx.y
+$(OUTPUT_DIR)/ptx.tab.c: ptx.y
+ bison --name-prefix=ptx_ -v -d ptx.y --file-prefix=$(OUTPUT_DIR)/ptx
-ptxinfo.tab.c: ptxinfo.y
- bison --name-prefix=ptxinfo_ -v -d ptxinfo.y
+$(OUTPUT_DIR)/ptxinfo.tab.c: ptxinfo.y
+ bison --name-prefix=ptxinfo_ -v -d ptxinfo.y --file-prefix=$(OUTPUT_DIR)/ptxinfo
-lex.ptx_.c: ptx.l
- flex ptx.l
+$(OUTPUT_DIR)/lex.ptx_.c: ptx.l
+ flex --outfile=$(OUTPUT_DIR)/lex.ptx_.c ptx.l
-lex.ptxinfo_.c: ptxinfo.l
- flex ptxinfo.l
+$(OUTPUT_DIR)/lex.ptxinfo_.c: ptxinfo.l
+ flex --outfile=$(OUTPUT_DIR)/lex.ptxinfo_.c ptxinfo.l
clean:
rm -f *~ *.o *.gcda *.gcno *.gcov libgpgpu_ptx_sim.a \
ptx.tab.h ptx.tab.c ptx.output lex.ptx_.c \
ptxinfo.tab.h ptxinfo.tab.c ptxinfo.output lex.ptxinfo_.c \
instructions.h ptx_parser_decode.def directed_tests.log
- rm -f decuda_pred_table/*.o
- rm -f Makefile.makedepend Makefile.makedepend.bak
+ rm -f $(OUTPUT_DIR)/decuda_pred_table/*.o
+ rm -f $(OUTPUT_DIR)/Makefile.makedepend $(OUTPUT_DIR)/Makefile.makedepend.bak
$(OUTPUT_DIR)/%.o: %.c
$(CPP) -c $(OPT) $< -o $(OUTPUT_DIR)/$*.o
$(OUTPUT_DIR)/%.o: %.cc
$(CPP) -c $(CXX_OPT) $< -o $(OUTPUT_DIR)/$*.o
-instructions.h: instructions.cc
+$(OUTPUT_DIR)/instructions.h: instructions.cc
@touch $*.h
@chmod +w $*.h
@echo "// DO NOT EDIT THIS FILE! IT IS AUTOMATICALLY GENERATED BY THE MAKEFILE (see target for instructions.h)" > $*.h
@@ -125,25 +125,25 @@ instructions.h: instructions.cc
@cat $< | grep "_impl(" | sed 's/{.*//' | sed 's/$$/;/' >> $*.h
@echo "#endif" >> $*.h
@chmod -w $*.h
- @echo "created instructions.h"
+ @echo "created $(OUTPUT_DIR)/instructions.h"
-ptx_parser_decode.def: ptx.tab.c
+$(OUTPUT_DIR)/ptx_parser_decode.def: $(OUTPUT_DIR)/ptx.tab.c
ifeq ($(shell uname),Linux)
- cat ptx.tab.h | grep "=" | sed 's/^[ ]\+//' | sed 's/[=,]//g' | sed 's/\([_A-Z1-9]\+\)[ ]\+\([0-9]\+\)/\1 \1/' | sed 's/^/DEF(/' | sed 's/ /,"/' | sed 's/$$/")/' > ptx_parser_decode.def
+ cat $(OUTPUT_DIR)/ptx.tab.h | grep "=" | sed 's/^[ ]\+//' | sed 's/[=,]//g' | sed 's/\([_A-Z1-9]\+\)[ ]\+\([0-9]\+\)/\1 \1/' | sed 's/^/DEF(/' | sed 's/ /,"/' | sed 's/$$/")/' > $(OUTPUT_DIR)/ptx_parser_decode.def
else
- cat ptx.tab.h | grep "=" | sed -E 's/^ +//' | sed 's/[=,]//g' | sed -E 's/([_A-Z1-9]+).*/\1 \1/' | sed 's/^/DEF(/' | sed 's/ /,"/' | sed 's/$$/")/' > ptx_parser_decode.def
+ cat $(OUTPUT_DIR)/ptx.tab.h | grep "=" | sed -E 's/^ +//' | sed 's/[=,]//g' | sed -E 's/([_A-Z1-9]+).*/\1 \1/' | sed 's/^/DEF(/' | sed 's/ /,"/' | sed 's/$$/")/' > $(OUTPUT_DIR)/ptx_parser_decode.def
endif
-$(OUTPUT_DIR)/instructions.o: instructions.h ptx.tab.c
-$(OUTPUT_DIR)/cuda_device_printf.o: ptx.tab.c
-$(OUTPUT_DIR)/ptx_ir.o: ptx.tab.c ptx_parser_decode.def
-$(OUTPUT_DIR)/ptx_loader.o: ptx.tab.c ptx_parser_decode.def
-$(OUTPUT_DIR)/ptx_parser.o: ptx.tab.c ptx_parser_decode.def
-$(OUTPUT_DIR)/ptxinfo.tab.o: ptx.tab.c
-$(OUTPUT_DIR)/ptx-stats.o: ptx.tab.c
-$(OUTPUT_DIR)/ptx_sim.o: ptx.tab.c
-$(OUTPUT_DIR)/cuda-sim.o: ptx.tab.c
-$(OUTPUT_DIR)/lex.ptxinfo_.o: ptx.tab.c
-$(OUTPUT_DIR)/lex.ptx_.o: ptx.tab.c
-
+$(OUTPUT_DIR)/instructions.o: $(OUTPUT_DIR)/instructions.h $(OUTPUT_DIR)/ptx.tab.c
+$(OUTPUT_DIR)/cuda_device_printf.o: $(OUTPUT_DIR)/ptx.tab.c
+$(OUTPUT_DIR)/ptx_ir.o: $(OUTPUT_DIR)/ptx.tab.c $(OUTPUT_DIR)/ptx_parser_decode.def
+$(OUTPUT_DIR)/ptx_loader.o: $(OUTPUT_DIR)/ptx.tab.c $(OUTPUT_DIR)/ptx_parser_decode.def
+$(OUTPUT_DIR)/ptx_parser.o: $(OUTPUT_DIR)/ptx.tab.c $(OUTPUT_DIR)/ptx_parser_decode.def
+$(OUTPUT_DIR)/ptxinfo.tab.o: $(OUTPUT_DIR)/ptx.tab.c
+$(OUTPUT_DIR)/ptx-stats.o: $(OUTPUT_DIR)/ptx.tab.c
+$(OUTPUT_DIR)/ptx_sim.o: $(OUTPUT_DIR)/ptx.tab.c
+$(OUTPUT_DIR)/cuda-sim.o: $(OUTPUT_DIR)/ptx.tab.c
+$(OUTPUT_DIR)/lex.ptxinfo_.o: $(OUTPUT_DIR)/ptx.tab.c
+$(OUTPUT_DIR)/lex.ptx_.o: $(OUTPUT_DIR)/ptx.tab.c
+include $(OUTPUT_DIR)/Makefile.makedepend
diff --git a/src/gpgpu-sim/Makefile b/src/gpgpu-sim/Makefile
index b9749e5..e355b59 100644
--- a/src/gpgpu-sim/Makefile
+++ b/src/gpgpu-sim/Makefile
@@ -67,7 +67,7 @@ OPTFLAGS += -g3 -fPIC
CPP = g++ $(SNOW)
OEXT = o
-OUTPUT_DIR=../../$(SIM_OBJ_FILES_DIR)/gpgpu-sim
+OUTPUT_DIR=$(SIM_OBJ_FILES_DIR)/gpgpu-sim
SRCS = $(shell ls *.cc)
@@ -84,11 +84,11 @@ OBJS = $(CSRCS:%.cc=$(OUTPUT_DIR)/%.$(OEXT))
libgpu_uarch_sim.a:$(OBJS)
ar rcs $(OUTPUT_DIR)/libgpu_uarch_sim.a $(OBJS)
-Makefile.makedepend: depend
+$(OUTPUT_DIR)/Makefile.makedepend: depend
depend:
- touch Makefile.makedepend
- makedepend -fMakefile.makedepend -p$(OUTPUT_DIR)/ $(CSRCS) 2> /dev/null
+ touch $(OUTPUT_DIR)/Makefile.makedepend
+ makedepend -f$(OUTPUT_DIR)/Makefile.makedepend -p$(OUTPUT_DIR)/ $(CSRCS) 2> /dev/null
$(OUTPUT_DIR)/l2cache.$(OEXT): l2cache.cc
$(CPP) $(OPTFLAGS) $(CXXFLAGS_L2CACHE) -o $*.$(OEXT) -c l2cache.cc
@@ -102,10 +102,10 @@ clean:
$(OUTPUT_DIR)/option_parser.$(OEXT): option_parser.h
-$(OUTPUT_DIR)/dram_sched.$(OEXT): ../cuda-sim/ptx.tab.h
+$(OUTPUT_DIR)/dram_sched.$(OEXT): $(OUTPUT_DIR)/../cuda-sim/ptx.tab.h
-../cuda-sim/ptx.tab.h:
- make -C ../cuda-sim/ ptx.tab.c
+$(OUTPUT_DIR)/../cuda-sim/ptx.tab.h:
+ make -C ../cuda-sim/ $(OUTPUT_DIR)/../cuda-sim/ptx.tab.c
-include Makefile.makedepend
+include $(OUTPUT_DIR)/Makefile.makedepend
diff --git a/src/gpuwattch/cacti/cacti.mk b/src/gpuwattch/cacti/cacti.mk
index c8c2192..1de6e9e 100644
--- a/src/gpuwattch/cacti/cacti.mk
+++ b/src/gpuwattch/cacti/cacti.mk
@@ -1,3 +1,5 @@
+
+OUTPUT_DIR=$(SIM_OBJ_FILES_DIR)/gpuwattch/cacti
TARGET = cacti
SHELL = /bin/sh
.PHONY: all depend clean
@@ -35,30 +37,29 @@ SRCS = area.cc bank.cc mat.cc main.cc Ucache.cc io.cc technology.cc basic_circu
decoder.cc component.cc uca.cc subarray.cc wire.cc htree2.cc \
cacti_interface.cc router.cc nuca.cc crossbar.cc arbiter.cc
-OBJS = $(patsubst %.cc,obj_$(TAG)/%.o,$(SRCS))
-PYTHONLIB_SRCS = $(patsubst main.cc, ,$(SRCS)) obj_$(TAG)/cacti_wrap.cc
+OBJS = $(patsubst %.cc,$(OUTPUT_DIR)/%.o,$(SRCS))
+PYTHONLIB_SRCS = $(patsubst main.cc, ,$(SRCS)) $(OUTPUT_DIR)/cacti_wrap.cc
PYTHONLIB_OBJS = $(patsubst %.cc,%.o,$(PYTHONLIB_SRCS))
INCLUDES = -I /usr/include/python2.4 -I /usr/lib/python2.4/config
-all: obj_$(TAG)/$(TARGET)
- cp -f obj_$(TAG)/$(TARGET) $(TARGET)
+all: $(OUTPUT_DIR)/$(TARGET)
-obj_$(TAG)/$(TARGET) : $(OBJS)
+$(OUTPUT_DIR)/$(TARGET) : $(OBJS)
$(CXX) $(OBJS) -o $@ $(INCS) $(CXXFLAGS) $(LIBS) -pthread
#obj_$(TAG)/%.o : %.cc
# $(CXX) -c $(CXXFLAGS) $(INCS) -o $@ $<
-Makefile.makedepend: depend
+$(OUTPUT_DIR)/Makefile.makedepend: depend
depend:
- touch Makefile.makedepend
- makedepend -fMakefile.makedepend -pobj_$(TAG)/ -a $(SRCS) 2> /dev/null
+ touch $(OUTPUT_DIR)/Makefile.makedepend
+ makedepend -f$(OUTPUT_DIR)/Makefile.makedepend -p$(OUTPUT_DIR)/ -a $(SRCS) 2> /dev/null
-obj_$(TAG)/%.o : %.cc
+$(OUTPUT_DIR)/%.o : %.cc
$(CXX) $(CXXFLAGS) -c $< -o $@
clean:
-rm -f *.o _cacti.so cacti.py $(TARGET)
-include Makefile.makedepend
+include $(OUTPUT_DIR)/Makefile.makedepend
diff --git a/src/gpuwattch/mcpat.mk b/src/gpuwattch/mcpat.mk
index 64db479..a09c23b 100644
--- a/src/gpuwattch/mcpat.mk
+++ b/src/gpuwattch/mcpat.mk
@@ -1,3 +1,5 @@
+
+OUTPUT_DIR=$(SIM_OBJ_FILES_DIR)/gpuwattch
TARGET = mcpat
SHELL = /bin/sh
.PHONY: all depend clean
@@ -76,29 +78,28 @@ SRCS = \
-OBJS = $(patsubst %.cc,obj_$(TAG)/%.o,$(SRCS))
+OBJS = $(patsubst %.cc,$(OUTPUT_DIR)/%.o,$(SRCS))
-all: obj_$(TAG)/$(TARGET)
- cp -f obj_$(TAG)/$(TARGET) $(TARGET)
+all: $(OUTPUT_DIR)/$(TARGET)
-obj_$(TAG)/$(TARGET) : $(OBJS)
+$(OUTPUT_DIR)/$(TARGET) : $(OBJS)
$(CXX) $(OBJS) -o $@ $(INCS) $(CXXFLAGS) $(LIBS) -pthread
#obj_$(TAG)/%.o : %.cc
# $(CXX) -c $(CXXFLAGS) $(INCS) -o $@ $<
-obj_$(TAG)/%.o : %.cc
+$(OUTPUT_DIR)/%.o : %.cc
$(CXX) $(CXXFLAGS) -c $< -o $@
-Makefile.makedepend: depend
+$(OUTPUT_DIR)/Makefile.makedepend: depend
depend:
- touch Makefile.makedepend
- makedepend -fMakefile.makedepend -pobj_$(TAG)/ $(SRCS) 2> /dev/null
+ touch $(OUTPUT_DIR)/Makefile.makedepend
+ makedepend -f$(OUTPUT_DIR)/Makefile.makedepend -p$(OUTPUT_DIR)/ $(SRCS) 2> /dev/null
$(MAKE) -C ./cacti/ depend
clean:
-rm -f *.o $(TARGET)
rm -f Makefile.makedepend Makefile.makedepend.bak
-include Makefile.makedepend
+include $(OUTPUT_DIR)/Makefile.makedepend
diff --git a/src/intersim/Makefile b/src/intersim/Makefile
index 0613274..cf42bb5 100644
--- a/src/intersim/Makefile
+++ b/src/intersim/Makefile
@@ -13,16 +13,19 @@ LEX = flex
PURIFY = /usr/bin/purify
QUANT = /usr/bin/quantify
+OUTPUT_DIR=$(SIM_OBJ_FILES_DIR)/intersim
INTERFACE = interconnect_interface.cpp
DEBUG = 0
-CPPFLAGS = -g -Wall
+CPPFLAGS = -g -Wall
ifneq ($(DEBUG),1)
CPPFLAGS = -O3 -g
else
CPPFLAGS +=
endif
+CPPFLAGS += -I$(OUTPUT_DIR) -I.
+
TEST = -DUNIT_TEST
ifneq ($(UNIT_TEST),1)
TEST =
@@ -32,7 +35,6 @@ endif
PROG = intersim
-OUTPUT_DIR=../../$(SIM_OBJ_FILES_DIR)/intersim
CPP_SRCS = $(INTERFACE) \
config_utils.cpp \
@@ -69,23 +71,18 @@ CPP_SRCS = $(INTERFACE) \
rng_double_wrapper.cpp \
statwraper.cpp
-#LEX_OBJS = $(OUTPUT_DIR)/configlex.o
-LEX_OBJS = configlex.o
-#YACC_OBJS = $(OUTPUT_DIR)/config_tab.o
-YACC_OBJS = config_tab.o
+LEX_OBJS = $(OUTPUT_DIR)/configlex.o
+YACC_OBJS = $(OUTPUT_DIR)/config_tab.o
#--- Make rules ---
OBJS = $(CPP_SRCS:%.cpp=$(OUTPUT_DIR)/%.o) $(LEX_OBJS) $(YACC_OBJS)
.PHONY: clean
-.PRECIOUS: %_tab.cpp %_tab.hpp %lex.cpp
+.PRECIOUS: $(OUTPUT_DIR)/%_tab.cpp $(OUTPUT_DIR)/%_tab.hpp $(OUTPUT_DIR)/%lex.cpp
lib$(PROG).a: $(OBJS)
ar rcs $(OUTPUT_DIR)/lib$(PROG).a $(OBJS)
- mv $(LEX_OBJS) $(OUTPUT_DIR)/
- mv $(YACC_OBJS) $(OUTPUT_DIR)/
-
purify: $(OBJS)
$(PURIFY) -always-use-cache-dir $(CPP) $(OBJS) -o $(PROG) -L/usr/lib
@@ -93,26 +90,29 @@ purify: $(OBJS)
quantify: $(OBJS)
$(QUANT) -always-use-cache-dir $(CPP) $(OBJS) -o $(PROG) -L/usr/lib
-%lex.o: %lex.cpp %_tab.hpp
+$(OUTPUT_DIR)/%lex.o: $(OUTPUT_DIR)/%lex.cpp $(OUTPUT_DIR)/%_tab.hpp
$(CPP) $(CPPFLAGS) -c $< -o $@
$(OUTPUT_DIR)/%.o: %.cpp
$(CPP) $(EXTRA) $(CPPFLAGS) $(TEST) -c $< -o $@
+
+$(OUTPUT_DIR)/%.o: $(OUTPUT_DIR)/%.cpp
+ $(CPP) $(EXTRA) $(CPPFLAGS) $(TEST) -c $< -o $@
$(OUTPUT_DIR)/%.o: %.c
$(CPP) $(CPPFLAGS) $(TEST) $(VCSFLAGS) -c $< -o $@
-%_tab.cpp: %.y
- $(YACC) -b$* -p$* $<
- cp -f $*.tab.c $*_tab.cpp
+$(OUTPUT_DIR)/%_tab.cpp: %.y
+ $(YACC) -b$* -p$* $< --file-prefix=$(OUTPUT_DIR)/$*
+ cp -f $(OUTPUT_DIR)/$*.tab.c $(OUTPUT_DIR)/$*_tab.cpp
-%_tab.hpp: %_tab.cpp
- cp -f $*.tab.h $*_tab.hpp
+$(OUTPUT_DIR)/%_tab.hpp: $(OUTPUT_DIR)/%_tab.cpp
+ cp -f $(OUTPUT_DIR)/$*.tab.h $(OUTPUT_DIR)/$*_tab.hpp
-%lex.cpp: %.l
- $(LEX) -P$* -o$@ $<
- cp configlex.cpp configlex.cpp.orig
- awk '/configlineno = 1/ {if (line == 0) {line = 1; print} next;} //{print}' configlex.cpp.orig > configlex.cpp
+$(OUTPUT_DIR)/%lex.cpp: %.l
+ $(LEX) --outfile=$@ -P$* $<
+ cp $(OUTPUT_DIR)/configlex.cpp $(OUTPUT_DIR)/configlex.cpp.orig
+ awk '/configlineno = 1/ {if (line == 0) {line = 1; print} next;} //{print}' $(OUTPUT_DIR)/configlex.cpp.orig > $(OUTPUT_DIR)/configlex.cpp
clean:
rm -f $(OBJS) *_tab.cpp *_tab.hpp *.tab.c *.tab.h *lex.cpp
@@ -121,7 +121,7 @@ clean:
rm -f lib$(PROG).so
rm -f $(OBJS) *.o
-interconnect_interface.o: ../cuda-sim/ptx.tab.h
+$(OUTPUT_DIR)/interconnect_interface.o: $(OUTPUT_DIR)/../cuda-sim/ptx.tab.h
-../cuda-sim/ptx.tab.h:
- make -C ../cuda-sim/ ptx.tab.c
+$(OUTPUT_DIR)/../cuda-sim/ptx.tab.h:
+ make -C ../cuda-sim/ $(OUTPUT_DIR)/../cuda-sim/ptx.tab.c