/[dynamips]/upstream/dynamips-0.2.7-RC2/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.7-RC2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8 - (show annotations)
Sat Oct 6 16:24:54 2007 UTC (12 years, 1 month ago) by dpavlin
File size: 8386 byte(s)
dynamips-0.2.7-RC2

1 # Makefile for Dynamips 0.2.6
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.7
17 VERSION_SUB=-RC2
18
19 VERSION=$(VERSION_TRAIN)$(VERSION_SUB)
20 VERSION_DEV=$(VERSION_TRAIN)-$(shell date +%Y%m%d-%H)
21
22 # Executable binary extension
23 DESTDIR?=/usr
24 BIN_EXT?=
25
26 CC?=gcc
27 LD=ld
28 RM=rm
29 TAR=tar
30 CP=cp
31 LEX=flex
32 MIPS64_ARCH_INC_FILE=\"mips64_$(DYNAMIPS_ARCH)_trans.h\"
33 PPC32_ARCH_INC_FILE=\"ppc32_$(DYNAMIPS_ARCH)_trans.h\"
34
35 CFLAGS+=-g -Wall -O3 -fomit-frame-pointer \
36 -DJIT_ARCH=\"$(DYNAMIPS_ARCH)\" \
37 -DMIPS64_ARCH_INC_FILE=$(MIPS64_ARCH_INC_FILE) \
38 -DPPC32_ARCH_INC_FILE=$(PPC32_ARCH_INC_FILE) \
39 -DDYNAMIPS_VERSION=\"$(VERSION)\" \
40 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
41 -DHAS_RFC2553=$(HAS_RFC2553)
42
43 PCAP_LIB=/usr/local/lib/libpcap.a
44 #PCAP_LIB=-lpcap
45
46 ifeq ($(shell uname), FreeBSD)
47 PTHREAD_LIBS?=-pthread
48 CFLAGS+=-I/usr/local/include -I/usr/local/include/libelf $(PTHREAD_CFLAGS) \
49 -D_FILE_OFFSET_BITS=64
50 LIBS=-L/usr/local/lib -L. -lelf $(PTHREAD_LIBS)
51 else
52 ifeq ($(shell uname), Linux)
53 PTHREAD_LIBS?=-lpthread
54 # PCAP_LIB=-lpcap
55 CFLAGS+=-I/usr/include -I. $(PTHREAD_CFLAGS)
56 LIBS=-L/usr/lib -L. /usr/lib/libelf.a $(PTHREAD_LIBS)
57 DESTDIR=/usr
58 else
59 ifeq ($(shell uname -s), Darwin)
60 CFLAGS+=-I/usr/local/include -mdynamic-no-pic -D_FILE_OFFSET_BITS=64
61 LIBS=-L/usr/local/lib -L. -lelf -lpthread
62 else
63 ifeq ($(shell uname -s), SunOS)
64 CFLAGS+=-I/usr/local/include -DINADDR_NONE=0xFFFFFFFF \
65 -I /opt/csw/include -DSUNOS
66 LIBS=-L/usr/local/lib -L. -lelf -lpthread -L/opt/csw/lib \
67 -lsocket -lnsl -lresolv
68 PCAP_LIB=/opt/csw/lib/libpcap.a
69 else
70 ifeq ($(shell uname -o), Cygwin)
71 CFLAGS+=-I/usr/local/include -I/usr/local/include/libelf -DCYGWIN \
72 -D_FILE_OFFSET_BITS=64
73 LIBS=-L/usr/local/lib -L. -lelf -lpthread
74 PCAP_LIB=-lpacket -lwpcap
75 else
76 CFLAGS+=-I/usr/include/libelf -D_FILE_OFFSET_BITS=64
77 LIBS=-L. /usr/lib/libelf.a -lpthread
78 endif
79 endif
80 endif
81 endif
82 endif
83
84 PROG=dynamips$(BIN_EXT)
85 PACKAGE=$(PROG)-$(VERSION)
86 ARCHIVE=$(PACKAGE).tar.gz
87
88 PACKAGE_DEV=$(PROG)-$(VERSION_DEV)
89 ARCHIVE_DEV=$(PACKAGE_DEV).tar.gz
90
91 # Header and source files
92 HDR=mempool.h registry.h rbtree.h hash.h utils.h parser.h \
93 crc.h sbox.h base64.h net.h net_io.h net_io_bridge.h net_io_filter.h \
94 atm.h frame_relay.h eth_switch.h \
95 ptask.h timer.h dev_vtty.h hypervisor.h dynamips.h insn_lookup.h \
96 vm.h cpu.h memory.h device.h \
97 mips64.h mips64_mem.h mips64_exec.h mips64_jit.h mips64_cp0.h \
98 ppc32.h ppc32_mem.h ppc32_exec.h ppc32_jit.h ppc32_vmtest.h \
99 nmc93cX6.h cisco_eeprom.h ds1620.h dev_rom.h \
100 pci_dev.h pci_io.h dev_mpc860.h dev_gt.h dev_mv64460.h dev_plx.h \
101 dev_dec21140.h dev_am79c971.h dev_i8254x.h \
102 dev_mueslix.h dev_nm_16esw.h \
103 dev_c7200.h dev_c7200_mpfpga.h \
104 dev_c3600.h dev_c3600_iofpga.h dev_c3600_bay.h \
105 dev_c2691.h dev_c2691_iofpga.h \
106 dev_c3725.h dev_c3725_iofpga.h \
107 dev_c3745.h dev_c3745_iofpga.h \
108 dev_c2600.h dev_c2600_iofpga.h \
109 dev_msfc1.h dev_msfc1_mpfpga.h
110
111 SOURCES=mempool.c registry.c rbtree.c hash.c sbox.c utils.c parser.c \
112 ptask.c timer.c crc.c base64.c \
113 net.c net_io.c net_io_bridge.c net_io_filter.c \
114 atm.c frame_relay.c eth_switch.c \
115 dynamips.c insn_lookup.c vm.c cpu.c \
116 mips64.c mips64_mem.c mips64_cp0.c mips64_jit.c mips64_exec.c \
117 ppc32.c ppc32_mem.c ppc32_jit.c ppc32_exec.c ppc32_vmtest.c \
118 memory.c device.c nmc93cX6.c cisco_eeprom.c \
119 pci_dev.c pci_io.c \
120 dev_zero.c dev_bswap.c dev_vtty.c dev_ram.c dev_rom.c dev_nvram.c \
121 dev_bootflash.c dev_flash.c dev_mpc860.c \
122 dev_remote.c dev_clpd6729.c dev_pcmcia_disk.c dev_gt.c dev_mv64460.c \
123 dev_plx.c dev_dec21x50.c dev_pericom.c dev_ti2050b.c dev_ap1011.c \
124 dev_plx6520cb.c \
125 dev_ns16552.c dev_dec21140.c dev_am79c971.c dev_i8254x.c \
126 dev_mueslix.c \
127 dev_c3600.c dev_c3600_bay.c dev_c3600_iofpga.c \
128 dev_c3600_eth.c dev_c3600_serial.c \
129 dev_c7200.c dev_c7200_iofpga.c dev_c7200_mpfpga.c \
130 dev_c7200_sram.c dev_c7200_eth.c dev_c7200_serial.c dev_c7200_pos.c \
131 dev_c7200_bri.c \
132 dev_c2691.c dev_c2691_iofpga.c dev_c2691_eth.c dev_c2691_serial.c \
133 dev_c3725.c dev_c3725_iofpga.c dev_c3725_eth.c dev_c3725_serial.c \
134 dev_c3745.c dev_c3745_iofpga.c dev_c3745_eth.c dev_c3745_serial.c \
135 dev_c2600.c dev_c2600_pci.c dev_c2600_iofpga.c dev_c2600_eth.c \
136 dev_msfc1.c dev_msfc1_iofpga.c dev_msfc1_mpfpga.c \
137 dev_nm_16esw.c dev_pa_a1.c dev_pa_mc8te1.c \
138 dev_sb1.c dev_sb1_io.c dev_sb1_pci.c hypervisor.c \
139 hv_nio.c hv_nio_bridge.c hv_frsw.c hv_atmsw.c hv_ethsw.c \
140 hv_vm.c hv_vm_debug.c \
141 hv_c7200.c hv_c3600.c hv_c2691.c hv_c3725.c hv_c3745.c hv_c2600.c
142
143 # Profiling
144 #SOURCES += profiler.c
145 #CFLAGS += -p -DPROFILE -DPROFILE_FILE=\"$(PROG).profile\"
146
147 ifeq ($(DYNAMIPS_ARCH),x86)
148 HDR += x86-codegen.h mips64_x86_trans.h ppc32_x86_trans.h
149 SOURCES += mips64_x86_trans.c ppc32_x86_trans.c
150 endif
151
152 ifeq ($(DYNAMIPS_ARCH),amd64)
153 HDR += x86-codegen.h amd64-codegen.h mips64_amd64_trans.h ppc32_amd64_trans.h
154 SOURCES += mips64_amd64_trans.c ppc32_amd64_trans.c
155 endif
156
157 ifeq ($(DYNAMIPS_ARCH),nojit)
158 HDR += mips64_nojit_trans.h ppc32_nojit_trans.h
159 SOURCES += mips64_nojit_trans.c ppc32_nojit_trans.c
160 endif
161
162 # RAW Ethernet support for Linux
163 ifeq ($(shell uname), Linux)
164 CFLAGS += -DLINUX_ETH
165 HDR += linux_eth.h
166 SOURCES += linux_eth.c
167 endif
168
169 # Generic Ethernet support with libpcap (0.9+)
170 ifeq ($(HAS_PCAP), 1)
171 CFLAGS += -DGEN_ETH
172 HDR += gen_eth.h
173 SOURCES += gen_eth.c
174
175 LIBS += $(PCAP_LIB)
176 endif
177
178 C_OBJS=$(SOURCES:.c=.o)
179 A_OBJS=$(ASMSRC:.S=.o)
180 LEX_C=$(LEX_SOURCES:.l=.c)
181
182 SUPPL=mips_mts.c Makefile ChangeLog COPYING README README.hypervisor TODO \
183 dynamips.1 nvram_export.1 hypervisor_mode.7 \
184 mips64_microcode ppc32_microcode debian/
185
186 FILE_LIST := $(HDR) $(SOURCES) $(SUPPL) \
187 x86-codegen.h amd64-codegen.h \
188 mips64_x86_trans.c mips64_x86_trans.h \
189 mips64_amd64_trans.c mips64_amd64_trans.h \
190 mips64_nojit_trans.c mips64_nojit_trans.h \
191 ppc32_x86_trans.c ppc32_x86_trans.h \
192 ppc32_amd64_trans.c ppc32_amd64_trans.h \
193 ppc32_nojit_trans.c ppc32_nojit_trans.h \
194 linux_eth.c linux_eth.h gen_eth.c gen_eth.h \
195 profiler.c profiler_resolve.pl bin2c.c rom2c.c \
196 nvram_export.c udp_send.c
197
198 .PHONY: all
199 all: $(PROG) nvram_export
200
201 $(PROG): mips64_microcode_dump.inc ppc32_microcode_dump.inc \
202 $(LEX_C) $(C_OBJS) $(A_OBJS)
203 @echo "Linking $@"
204 @$(CC) -o $@ $(C_OBJS) $(A_OBJS) $(LIBS)
205
206 udp_send$(BIN_EXT): udp_send.c net.c
207 @echo "Linking $@"
208 @$(CC) -Wall $(CFLAGS) -o $@ udp_send.c net.c $(LIBS)
209
210 rom2c$(BIN_EXT): rom2c.c
211 @echo "Linking $@"
212 @$(CC) -Wall $(CFLAGS) -o $@ rom2c.c $(LIBS)
213
214 mips64_microcode_dump.inc: rom2c$(BIN_EXT) mips64_microcode
215 @./rom2c mips64_microcode mips64_microcode_dump.inc 0xbfc00000
216
217 ppc32_microcode_dump.inc: rom2c$(BIN_EXT) ppc32_microcode
218 @./rom2c ppc32_microcode ppc32_microcode_dump.inc 0xfff00000
219
220 asmdefs$(BIN_EXT): asmdefs.c mips64.h
221 @echo "Linking $@"
222 @$(CC) -Wall $(CFLAGS) -o $@ asmdefs.c
223
224 asmdefs.h: asmdefs$(BIN_EXT)
225 @echo "Building assembly definitions header file"
226 @./asmdefs
227
228 nvram_export$(BIN_EXT): nvram_export.c
229 @echo "Linking $@"
230 @$(CC) -Wall $(CFLAGS) -o $@ nvram_export.c
231
232 install: $(PROG) nvram_export
233 @echo "Installing"
234 install -d $(DESTDIR)/bin $(DESTDIR)/man/man1 $(DESTDIR)/man/man7 $(DESTDIR)/etc
235 install dynamips nvram_export $(DESTDIR)/bin
236 install -m644 dynamips.1 $(DESTDIR)/man/man1
237 install -m644 nvram_export.1 $(DESTDIR)/man/man1
238 install -m644 hypervisor_mode.7 $(DESTDIR)/man/man7
239 # install -m644 example $(DESTDIR)/etc/dynamips
240
241
242 .PHONY: clean
243 clean:
244 $(RM) -f rom2c$(BIN_EXT) microcode_dump.inc asmdefs$(BIN_EXT) \
245 asmdefs.h $(C_OBJS) $(A_OBJS) $(PROG)
246 $(RM) -f *~
247
248 .PHONY: package
249 package:
250 @mkdir -p distrib/$(PACKAGE)
251 @$(CP) -r $(FILE_LIST) distrib/$(PACKAGE)
252 @cd distrib ; $(TAR) czf $(ARCHIVE) $(PACKAGE)
253
254 .PHONY: packdev
255 packdev:
256 @mkdir -p distrib/$(PACKAGE_DEV)
257 @$(CP) -r $(FILE_LIST) distrib/$(PACKAGE_DEV)
258 @cd distrib ; $(TAR) czf $(ARCHIVE_DEV) $(PACKAGE_DEV)
259
260 .SUFFIXES: .c .h .S .l .y .o
261
262 .S.o:
263 @echo "Assembling $<"
264 @$(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $<
265
266 .c.o:
267 @echo "Compiling $<"
268 @$(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $<
269
270 .l.c:
271 $(LEX) -o$*.c $<

  ViewVC Help
Powered by ViewVC 1.1.26