summaryrefslogtreecommitdiff
path: root/Makefile
blob: 1f2a4c03161a3b7a60520ae576cfcf44530dd472 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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_*
contact: Jan Huwald // Impressum