/[dynamips]/upstream/dynamips-0.2.6-RC1/Makefile
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /upstream/dynamips-0.2.6-RC1/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations)
Sat Oct 6 16:03:58 2007 UTC (12 years, 1 month ago) by dpavlin
File size: 5706 byte(s)
import dynamips-0.2.6-RC1

1 # Makefile for Dynamips 0.2.5
2 # Copyright (c) 2005-2006 Christophe Fillot.
3
4 # Replace x86 by amd64 for a build on x86_64.
5 # Use "nojit" for architectures that are not x86 or x86_64.
6 DYNAMIPS_ARCH?=x86
7
8 # Change this to 0 if your system doesn't support RFC 2553 extensions
9 HAS_RFC2553?=1
10
11 # Change this to 1 if your system has libpcap-0.9.4 or better
12 # (WinPcap is used for Cygwin)
13 HAS_PCAP?=1
14
15 # Current dynamips release
16 VERSION_TRAIN=0.2.6
17 VERSION_SUB=-RC1
18
19 VERSION=$(VERSION_TRAIN)$(VERSION_SUB)
20 VERSION_DEV=$(VERSION_TRAIN)-$(shell date +%Y%m%d-%H)
21
22 # Executable binary extension
23 BIN_EXT?=
24
25 CC?=gcc
26 LD=ld
27 RM=rm
28 TAR=tar
29 CP=cp
30 LEX=flex
31 ARCH_INC_FILE=\"$(DYNAMIPS_ARCH)_trans.h\"
32 CFLAGS+=-g -Wall -O3 -fomit-frame-pointer \
33 -DJIT_ARCH=\"$(DYNAMIPS_ARCH)\" \
34 -DARCH_INC_FILE=$(ARCH_INC_FILE) -DDYNAMIPS_VERSION=\"$(VERSION)\" \
35 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
36 -DHAS_RFC2553=$(HAS_RFC2553)
37
38 PCAP_LIB=/usr/local/lib/libpcap.a
39 #PCAP_LIB=-lpcap
40
41 ifeq ($(shell uname), FreeBSD)
42 PTHREAD_LIBS?=-pthread
43 CFLAGS+=-I/usr/local/include -I/usr/local/include/libelf $(PTHREAD_CFLAGS)
44 LIBS=-L/usr/local/lib -L. -lelf $(PTHREAD_LIBS)
45 else
46 ifeq ($(shell uname -s), Darwin)
47 CFLAGS+=-I/usr/local/include -mdynamic-no-pic
48 LIBS=-L/usr/local/lib -L. -lelf -lpthread
49 else
50 ifeq ($(shell uname -o), Cygwin)
51 CFLAGS+=-I/usr/local/include -I/usr/local/include/libelf -DCYGWIN
52 LIBS=-L/usr/local/lib -L. -lelf -lpthread
53 PCAP_LIB=-lpacket -lwpcap
54 else
55 CFLAGS+=-I/usr/include/libelf
56 LIBS=-L. /usr/lib/libelf.a -lpthread
57 endif
58 endif
59 endif
60
61 PROG=dynamips$(BIN_EXT)
62 PACKAGE=$(PROG)-$(VERSION)
63 ARCHIVE=$(PACKAGE).tar.gz
64
65 PACKAGE_DEV=$(PROG)-$(VERSION_DEV)
66 ARCHIVE_DEV=$(PACKAGE_DEV).tar.gz
67
68 # Header and source files
69 HDR=mempool.h registry.h rbtree.h hash.h utils.h parser.h \
70 crc.h base64.h net.h net_io.h net_io_bridge.h net_io_filter.h \
71 atm.h frame_relay.h eth_switch.h \
72 ptask.h hypervisor.h dynamips.h insn_lookup.h \
73 vm.h mips64.h mips64_exec.h cpu.h cp0.h memory.h device.h \
74 nmc93c46.h cisco_eeprom.h ds1620.h pci_dev.h pci_io.h \
75 dev_dec21140.h dev_am79c971.h dev_mueslix.h \
76 dev_vtty.h dev_c7200.h dev_c3600.h dev_c3600_bay.h
77 SOURCES=mempool.c registry.c rbtree.c hash.c utils.c parser.c ptask.c \
78 crc.c base64.c net.c net_io.c net_io_bridge.c net_io_filter.c \
79 atm.c frame_relay.c eth_switch.c \
80 dynamips.c insn_lookup.c vm.c mips64.c mips64_jit.c mips64_exec.c \
81 cpu.c cp0.c memory.c device.c nmc93c46.c cisco_eeprom.c \
82 pci_dev.c pci_io.c \
83 dev_zero.c dev_vtty.c dev_ram.c dev_rom.c dev_nvram.c dev_bootflash.c \
84 dev_remote.c dev_clpd6729.c dev_pcmcia_disk.c dev_gt64k.c \
85 dev_plx9060.c dev_dec21x50.c dev_pericom.c dev_ap1011.c \
86 dev_ns16552.c dev_dec21140.c dev_am79c971.c dev_mueslix.c \
87 dev_c3600.c dev_c3600_bay.c dev_c3600_iofpga.c \
88 dev_c3600_eth.c dev_c3600_serial.c dev_c3600_esw.c \
89 dev_c7200.c dev_c7200_iofpga.c dev_c7200_mpfpga.c \
90 dev_c7200_sram.c dev_c7200_eth.c dev_c7200_serial.c dev_c7200_pos.c \
91 dev_c7200_bri.c \
92 dev_pa_a1.c dev_sb1.c dev_sb1_io.c dev_sb1_pci.c hypervisor.c \
93 hv_nio.c hv_nio_bridge.c hv_frsw.c hv_atmsw.c hv_ethsw.c \
94 hv_vm.c hv_vm_debug.c hv_c7200.c hv_c3600.c
95
96 # Profiling
97 #SOURCES += profiler.c
98 #CFLAGS += -p -DPROFILE -DPROFILE_FILE=\"$(PROG).profile\"
99
100 ifeq ($(DYNAMIPS_ARCH),x86)
101 HDR += x86-codegen.h x86_trans.h
102 SOURCES += x86_trans.c
103 ASMSRC += x86_asm.S
104 CFLAGS += -DFAST_ASM
105 endif
106
107 ifeq ($(DYNAMIPS_ARCH),amd64)
108 HDR += x86-codegen.h amd64-codegen.h amd64_trans.h
109 SOURCES += amd64_trans.c
110 endif
111
112 ifeq ($(DYNAMIPS_ARCH),nojit)
113 HDR += nojit_trans.h
114 SOURCES += nojit_trans.c
115 endif
116
117 # RAW Ethernet support for Linux
118 ifeq ($(shell uname), Linux)
119 CFLAGS += -DLINUX_ETH
120 HDR += linux_eth.h
121 SOURCES += linux_eth.c
122 endif
123
124 # Generic Ethernet support with libpcap (0.9+)
125 ifeq ($(HAS_PCAP), 1)
126 CFLAGS += -DGEN_ETH
127 HDR += gen_eth.h
128 SOURCES += gen_eth.c
129
130 LIBS += $(PCAP_LIB)
131 endif
132
133 C_OBJS=$(SOURCES:.c=.o)
134 A_OBJS=$(ASMSRC:.S=.o)
135 LEX_C=$(LEX_SOURCES:.l=.c)
136
137 SUPPL=Makefile ChangeLog COPYING README README.hypervisor TODO \
138 dynamips.1 nvram_export.1 hypervisor_mode.7 microcode
139 FILE_LIST := $(HDR) $(SOURCES) $(SUPPL) \
140 x86-codegen.h x86_trans.c x86_trans.h x86_asm.S \
141 amd64-codegen.h amd64_trans.c amd64_trans.h \
142 nojit_trans.c nojit_trans.h asmdefs.c \
143 linux_eth.c linux_eth.h gen_eth.c gen_eth.h \
144 profiler.c profiler_resolve.pl bin2c.c rom2c.c \
145 nvram_export.c
146
147 .PHONY: all
148 all: $(PROG) nvram_export
149
150 $(PROG): microcode_dump.inc asmdefs.h $(LEX_C) $(C_OBJS) $(A_OBJS)
151 @echo "Linking $@"
152 @$(CC) -o $@ $(C_OBJS) $(A_OBJS) $(LIBS)
153
154 rom2c$(BIN_EXT): rom2c.c
155 @echo "Linking $@"
156 @$(CC) -Wall $(CFLAGS) -o $@ rom2c.c $(LIBS)
157
158 microcode_dump.inc: rom2c$(BIN_EXT) microcode
159 @$(CC) -Wall $(CFLAGS) -o $@ rom2c.c $(LIBS)
160 @./rom2c microcode microcode_dump.inc
161
162 asmdefs$(BIN_EXT): asmdefs.c mips64.h
163 @echo "Linking $@"
164 @$(CC) -Wall $(CFLAGS) -o $@ asmdefs.c
165
166 asmdefs.h: asmdefs$(BIN_EXT)
167 @echo "Building assembly definitions header file"
168 @./asmdefs
169
170 nvram_export$(BIN_EXT): nvram_export.c
171 @echo "Linking $@"
172 @$(CC) -Wall $(CFLAGS) -o $@ nvram_export.c
173
174 .PHONY: clean
175 clean:
176 $(RM) -f rom2c$(BIN_EXT) microcode_dump.inc asmdefs$(BIN_EXT) \
177 asmdefs.h $(C_OBJS) $(A_OBJS) $(PROG)
178 $(RM) -f *~
179
180 .PHONY: package
181 package:
182 @mkdir -p distrib/$(PACKAGE)
183 @$(CP) $(FILE_LIST) distrib/$(PACKAGE)
184 @cd distrib ; $(TAR) czf $(ARCHIVE) $(PACKAGE)
185
186 .PHONY: packdev
187 packdev:
188 @mkdir -p distrib/$(PACKAGE_DEV)
189 @$(CP) $(FILE_LIST) distrib/$(PACKAGE_DEV)
190 @cd distrib ; $(TAR) czf $(ARCHIVE_DEV) $(PACKAGE_DEV)
191
192 .SUFFIXES: .c .h .S .l .y .o
193
194 .S.o:
195 @echo "Assembling $<"
196 @$(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $<
197
198 .c.o:
199 @echo "Compiling $<"
200 @$(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $<
201
202 .l.c:
203 $(LEX) -o$*.c $<

  ViewVC Help
Powered by ViewVC 1.1.26