diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1f2a4c0 --- /dev/null +++ b/Makefile @@ -0,0 +1,97 @@ +.SECONDARY: + +### compiler flags + +CC=g++-4.6.1 -std=c++0x -static-libstdc++ + +#ERR= +ERR=-Wall -Wfatal-errors -Wno-strict-aliasing + +ifeq ($(DBG), 1) + CCOPTS=-ggdb -O1 +else + CCOPTS =-O3 + CCOPTS +=-fwhole-program -march=native -mtune=native + CCOPTS +=-funsafe-math-optimizations -fno-math-errno -frename-registers + CCOPTS +=-freorder-blocks-and-partition +# CCOPTS += -ftree-parallelize-loops=4 +endif + +ifeq ($(PROF), 1) + CCOPTS +=-pg +endif + +CCOPTS += -DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS +CCOPTS += -DBOOST_MPL_LIMIT_LIST_SIZE=30 + +.PHONY: all +all: exec doc reports + -echo "not enough yet" + false + +### TARGET FILES +EXEC=all_spikes bootstrap coarse_replay convert_topology list_synapses replay simulate spike_out spike_in track_causality +TEST=test_rng test_movector test_mmap test_mmap2 test_scalar test_vector test_checkpoint test_propcomp test_pla_getset test_pla_evolve test_prioque test_heap test_multi_queue test_typemap test_pla_apply test_index test_filter test_sim_loop +SPEEDTEST=test_index_speed test_prioque_speed test_propcomp_cpp-speed test_vector_speed +REPORT=report_names report_runtimeid report_spacereq + +ALL_EXEC=$(EXEC) $(TEST) $(SPEEDTEST) $(REPORT) + +### SUB MAKE FILES + +include make/asm.make +include make/doc.make +include make/model.make +include make/pgopt.make +include make/plot.make +include make/reports.make +include make/simulate.make +include make/test.make + +-include make/depend_core.mk +make/depend_core.mk: Makefile + @mkdir -p make/core + @for i in $(ALL_EXEC); do echo "-include make/core/$${i}.mk"; done > $@ +make/core/%.mk: core/%.cpp + @echo "Computing dependencies of $<" + @gcc -M -MG -MM -MT "$@ $(shell echo $@ | sed 's#make/core/\(.*\).mk#bin/\1.dep#')" $< | sed 's/properties.hpp//g' > $@; + +-include make/depend_model.mk +make/depend_model.mk: model/*model Makefile + ./toolbin/gen_model_deps.sh >> $@ +bin/%.dep: # deps come from make/core/* + @touch $@ + +### CORE CODE + +# default cases (used outside of sim for test cases, pgopt, ...) +SIM_MODEL=default +SIM_SEED=0 + +# HINT: deps are created automatically +.SECONDEXPANSION: +bin/%: SIM_MODEL=$(shell echo -e "$@\ndefault-" | egrep -o '[^/]*$$' | cut -s -f1 -d- | head -n1) +bin/%: CUR_EXEC= $(shell echo "$@" | egrep -o '[^/]*$$' | cut -f2- -d-) +bin/%: core/$$(CUR_EXEC).cpp bin/$$(CUR_EXEC).dep properties/$$(SIM_MODEL)/properties.hpp + @echo "Compiling $@" + @mkdir -p bin + @$(CC) $(PGOPTS) $(CCOPTS) $(ERR) $< -I. -Iproperties/$(SIM_MODEL) -o $@ + +properties/%/properties.hpp: model/%.model toolbin/transform_dsl.pl + @echo "Compiling $<" + @mkdir -p $(shell dirname $@) + @cd model && (../toolbin/transform_dsl.pl ../$< > ../$@ || (rm ../$@; false)) + + +### STD EXECUTABLES + +.PHONY: exec +exec: $(addprefix bin/,$(EXEC)) + +.PHONY: clean +clean: doc/clean + -rm {asm,asm/bin,bin,make/core}/* \ + {.,core,model,make,octave,R,tex,toolbin}/*{~,.gch} \ + make/depend_*.mk \ + model/*.auto.model + -rm -r {tmp,properties}/* tmp/.passed.test_* |