vcd: change VCD time base to 1 ns to handle higher AVR speeds (e.g. 20 MHz / max...
[simavr] / simavr / Makefile
1 #
2 #       Copyright 2008, 2009 Michel Pollet <buserror@gmail.com>
3 #
4 #       This file is part of simavr.
5 #
6 #       simavr is free software: you can redistribute it and/or modify
7 #       it under the terms of the GNU General Public License as published by
8 #       the Free Software Foundation, either version 3 of the License, or
9 #       (at your option) any later version.
10 #
11 #       simavr is distributed in the hope that it will be useful,
12 #       but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 #       GNU General Public License for more details.
15 #
16 #       You should have received a copy of the GNU General Public License
17 #       along with simavr.  If not, see <http://www.gnu.org/licenses/>.
18
19 target  = run_avr
20
21 CFLAGS  += -O3 -Wall -Werror
22
23 # tracing id useful especialy if you develop simavr core.
24 # it otherwise eat quite a bit of few cycles, even disabled
25 #CFLAGS += -DCONFIG_SIMAVR_TRACE=1
26
27 all:    obj libsimavr ${target}
28
29 include ../Makefile.common
30
31 cores   = ${wildcard cores/*.c}
32 cores_o = ${patsubst cores/%.c, ${OBJ}/%.o, ${cores}}
33 sim             = ${wildcard sim/sim_*.c} ${wildcard sim/avr_*.c}
34 sim_o   = ${patsubst sim/%.c, ${OBJ}/%.o, ${sim}}
35
36 VPATH   = cores
37 VPATH   += sim
38
39 IPATH   = sim
40 IPATH   += ../../shared
41 IPATH   += ../include
42
43 # Thats for MacPorts libelf
44 IPATH   += /opt/local/include
45 LFLAGS  = -L/opt/local/lib/
46
47 # shared library won't work that easily on non-linux
48 ifeq (${shell uname}, Linux)
49 all:    ${OBJ}/libsimavr.so
50 endif
51
52
53 ${OBJ}/libsimavr.a      :       ${cores_o}
54 ${OBJ}/libsimavr.a      :       ${sim_o}
55         @echo AR $@
56         @$(AR) cru $@ $^ && $(RANLIB) $@
57
58 libsimavr: ${OBJ}/libsimavr.a
59  
60 ${OBJ}/libsimavr.so     :       ${cores_o}
61 ${OBJ}/libsimavr.so     :       ${sim_o}
62         @echo LD $@
63         @$(CC) -shared -fPIC -o $@ $(LFLAGS) $^ $(LDFLAGS)
64
65 ${OBJ}/${target}.elf    :       ${OBJ}/${target}.o
66 ${OBJ}/${target}.elf    :       ${OBJ}/libsimavr.a
67
68 ${target}       : ${OBJ}/${target}.elf
69         ln -sf $< $@
70  
71 clean: clean-${OBJ}
72         rm -rf ${target} *.a *.so