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

Annotation of /upstream/dynamips-0.2.7-RC1/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7 - (hide annotations)
Sat Oct 6 16:23:47 2007 UTC (12 years, 2 months ago) by dpavlin
File size: 8018 byte(s)
dynamips-0.2.7-RC1

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

  ViewVC Help
Powered by ViewVC 1.1.26