1# makefile for species
2
3CC = gcc
4CPP = g++
5LD = g++
6
7OPT = -O4
8DBG =
9# Recommended extra options for gcc:
10#OPT += -fomit-frame-pointer -fforce-addr -finline-functions -funroll-loops
11#OPT += -mcpu=i686 -march=i686
12#DBG += -W -Wall -pedantic -ansi
13
14CFLAGS = ${OPT} ${DBG}
15CPPFLAGS = ${OPT} ${DBG}
16
17#set WXDIR if it isn't a global variable on your system, and you will be making visitool (species itself doesn't need wxWindows)
18WXCFLAGS = -I${WXDIR}/lib/wx/include/msw-2.4 -I${WXDIR}/include -I${WXDIR}/src/regex -I${WXDIR}/src/zlib -I${WXDIR}/src/png -I${WXDIR}/src/jpeg -I${WXDIR}/src/tiff -D_WIN32_IE=0x400 -D__WXMSW__ -mthreads -DWXUSINGDLL=1 -fno-pcc-struct-return -O4 -MMD -mthreads -Wall
19WXLD = -L${WXDIR}/lib -lwxmsw240 -Wl,--subsystem,windows -mwindows -mthreads
20
21#exhaust files
22EXHAUST = sim.o asm.o pspace.o
23
24#species files
25SPECIES = distribution.opp ini.opp mersenne.opp reproduction.opp error.opp \
26	length.opp species.opp fitness.opp rand.opp opcode_branch_lookup.opp \
27	warrior.opp genus.opp kingdom.opp inst_gen.opp \
28	inst_gen_weighted_random.opp inst_gen_markov.opp inst_gen_markov_2.opp \
29	operand.opp operand_distribution.opp operand_table.opp chromosome.opp \
30	exec_trail.opp
31
32EXECUTABLES = species
33
34all: species
35
36visitool: ${SPECIES} ${EXHAUST} visitool.opp
37	${LD} ${CFLAGS} -o visitool visitool.opp ${SPECIES} ${EXHAUST} ${WXLD}
38
39species: ${SPECIES} ${EXHAUST}  main.opp
40	${LD} ${CFLAGS} -o species main.opp ${SPECIES} ${EXHAUST}
41
42build_freq_tables: ${SPECIES} ${EXHAUST} build_freq_tables.opp
43	${LD} ${CFLAGS} -o build_freq_tables ${FILES} build_freq_tables.opp
44
45# compile c files
46
47%.o:	%.c
48	${CC} ${CFLAGS} -c $< -MD -MF $(<:%.c=%.dep) -o $@
49
50# compile c++ files
51
52%.opp:	%.cpp
53	${CPP} ${CFLAGS} -c $< -MD -MF $(<:%.cpp=%.dep) -o $@
54#misc
55
56clean:
57	rm -f *~ *.o *.opp *.dep core *.dat ${EXECUTABLES}
58
59release: species
60	strip ${EXECUTABLES}
61
62-include $(EXHAUST:%.o=%.dep) $(SPECIES:%.opp=%.dep)
63