summaryrefslogtreecommitdiff
path: root/src/cuda-sim/Makefile
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 /src/cuda-sim/Makefile
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]
Diffstat (limited to 'src/cuda-sim/Makefile')
-rw-r--r--src/cuda-sim/Makefile82
1 files changed, 41 insertions, 41 deletions
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