|
|
1.1.1.6 root 1: # Makefile for Dynamips 0.2.6
1.1 root 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.
1.1.1.3 root 6: DYNAMIPS_ARCH?=x86
1.1 root 7:
8: # Change this to 0 if your system doesn't support RFC 2553 extensions
1.1.1.4 root 9: HAS_RFC2553?=1
1.1 root 10:
1.1.1.2 root 11: # Change this to 1 if your system has libpcap-0.9.4 or better
12: # (WinPcap is used for Cygwin)
1.1.1.3 root 13: HAS_PCAP?=1
1.1.1.2 root 14:
1.1 root 15: # Current dynamips release
1.1.1.5 root 16: VERSION_TRAIN=0.2.6
1.1.1.7 ! root 17: VERSION_SUB=-RC3
1.1.1.5 root 18:
19: VERSION=$(VERSION_TRAIN)$(VERSION_SUB)
20: VERSION_DEV=$(VERSION_TRAIN)-$(shell date +%Y%m%d-%H)
1.1.1.4 root 21:
22: # Executable binary extension
1.1.1.7 ! root 23: DESTDIR?=/usr
1.1.1.4 root 24: BIN_EXT?=
1.1 root 25:
1.1.1.3 root 26: CC?=gcc
1.1 root 27: LD=ld
28: RM=rm
29: TAR=tar
30: CP=cp
31: LEX=flex
1.1.1.3 root 32: ARCH_INC_FILE=\"$(DYNAMIPS_ARCH)_trans.h\"
1.1.1.4 root 33: CFLAGS+=-g -Wall -O3 -fomit-frame-pointer \
34: -DJIT_ARCH=\"$(DYNAMIPS_ARCH)\" \
1.1.1.3 root 35: -DARCH_INC_FILE=$(ARCH_INC_FILE) -DDYNAMIPS_VERSION=\"$(VERSION)\" \
1.1.1.6 root 36: -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
1.1 root 37: -DHAS_RFC2553=$(HAS_RFC2553)
38:
1.1.1.4 root 39: PCAP_LIB=/usr/local/lib/libpcap.a
40: #PCAP_LIB=-lpcap
1.1.1.2 root 41:
1.1 root 42: ifeq ($(shell uname), FreeBSD)
1.1.1.3 root 43: PTHREAD_LIBS?=-pthread
1.1.1.6 root 44: CFLAGS+=-I/usr/local/include -I/usr/local/include/libelf $(PTHREAD_CFLAGS) \
45: -D_FILE_OFFSET_BITS=64
1.1.1.3 root 46: LIBS=-L/usr/local/lib -L. -lelf $(PTHREAD_LIBS)
1.1 root 47: else
1.1.1.7 ! root 48: ifeq ($(shell uname), Linux)
! 49: PTHREAD_LIBS?=-lpthread
! 50: PCAP_LIB=-lpcap
! 51: CFLAGS+=-I/usr/include -I. $(PTHREAD_CFLAGS)
! 52: LIBS=-L/usr/lib -L. -lelf $(PTHREAD_LIBS)
! 53: DESTDIR=/usr
! 54: else
1.1.1.2 root 55: ifeq ($(shell uname -s), Darwin)
1.1.1.6 root 56: CFLAGS+=-I/usr/local/include -mdynamic-no-pic -D_FILE_OFFSET_BITS=64
1.1.1.2 root 57: LIBS=-L/usr/local/lib -L. -lelf -lpthread
58: else
1.1.1.6 root 59: ifeq ($(shell uname -s), SunOS)
60: CFLAGS+=-I/usr/local/include -DINADDR_NONE=0xFFFFFFFF \
61: -I /opt/csw/include -DSUNOS
62: LIBS=-L/usr/local/lib -L. -lelf -lpthread -L/opt/csw/lib \
63: -lsocket -lnsl -lresolv
64: PCAP_LIB=/opt/csw/lib/libpcap.a
65: else
1.1 root 66: ifeq ($(shell uname -o), Cygwin)
1.1.1.6 root 67: CFLAGS+=-I/usr/local/include -I/usr/local/include/libelf -DCYGWIN \
68: -D_FILE_OFFSET_BITS=64
1.1 root 69: LIBS=-L/usr/local/lib -L. -lelf -lpthread
1.1.1.2 root 70: PCAP_LIB=-lpacket -lwpcap
1.1 root 71: else
1.1.1.6 root 72: CFLAGS+=-I/usr/include/libelf -D_FILE_OFFSET_BITS=64
1.1.1.4 root 73: LIBS=-L. /usr/lib/libelf.a -lpthread
1.1 root 74: endif
75: endif
1.1.1.2 root 76: endif
1.1.1.6 root 77: endif
1.1.1.7 ! root 78: endif
1.1 root 79:
1.1.1.4 root 80: PROG=dynamips$(BIN_EXT)
1.1 root 81: PACKAGE=$(PROG)-$(VERSION)
82: ARCHIVE=$(PACKAGE).tar.gz
83:
1.1.1.4 root 84: PACKAGE_DEV=$(PROG)-$(VERSION_DEV)
85: ARCHIVE_DEV=$(PACKAGE_DEV).tar.gz
86:
1.1 root 87: # Header and source files
1.1.1.4 root 88: HDR=mempool.h registry.h rbtree.h hash.h utils.h parser.h \
89: crc.h base64.h net.h net_io.h net_io_bridge.h net_io_filter.h \
90: atm.h frame_relay.h eth_switch.h \
1.1.1.6 root 91: ptask.h timer.h hypervisor.h dynamips.h insn_lookup.h \
1.1.1.4 root 92: vm.h mips64.h mips64_exec.h cpu.h cp0.h memory.h device.h \
1.1.1.7 ! root 93: nmc93c46.h cisco_eeprom.h ds1620.h \
! 94: pci_dev.h pci_io.h dev_gt.h dev_plx.h \
! 95: dev_dec21140.h dev_am79c971.h dev_mueslix.h dev_nm_16esw.h \
! 96: dev_vtty.h dev_c7200.h dev_c3600.h dev_c3600_bay.h \
! 97: dev_c2691.h dev_c3725.h dev_c3745.h
! 98:
1.1.1.6 root 99: SOURCES=mempool.c registry.c rbtree.c hash.c utils.c parser.c ptask.c timer.c \
1.1.1.4 root 100: crc.c base64.c net.c net_io.c net_io_bridge.c net_io_filter.c \
101: atm.c frame_relay.c eth_switch.c \
102: dynamips.c insn_lookup.c vm.c mips64.c mips64_jit.c mips64_exec.c \
103: cpu.c cp0.c memory.c device.c nmc93c46.c cisco_eeprom.c \
104: pci_dev.c pci_io.c \
1.1.1.7 ! root 105: dev_zero.c dev_vtty.c dev_ram.c dev_rom.c dev_nvram.c \
! 106: dev_bootflash.c dev_flash.c \
! 107: dev_remote.c dev_clpd6729.c dev_pcmcia_disk.c dev_gt.c \
! 108: dev_plx.c dev_dec21x50.c dev_pericom.c dev_ti2050b.c dev_ap1011.c \
1.1.1.4 root 109: dev_ns16552.c dev_dec21140.c dev_am79c971.c dev_mueslix.c \
110: dev_c3600.c dev_c3600_bay.c dev_c3600_iofpga.c \
1.1.1.7 ! root 111: dev_c3600_eth.c dev_c3600_serial.c \
1.1.1.4 root 112: dev_c7200.c dev_c7200_iofpga.c dev_c7200_mpfpga.c \
113: dev_c7200_sram.c dev_c7200_eth.c dev_c7200_serial.c dev_c7200_pos.c \
114: dev_c7200_bri.c \
1.1.1.7 ! root 115: dev_c2691.c dev_c2691_iofpga.c dev_c2691_eth.c dev_c2691_serial.c \
! 116: dev_c3725.c dev_c3725_iofpga.c dev_c3725_eth.c dev_c3725_serial.c \
! 117: dev_c3745.c dev_c3745_iofpga.c dev_c3745_eth.c dev_c3745_serial.c \
! 118: dev_nm_16esw.c dev_pa_a1.c dev_pa_mc8te1.c \
! 119: dev_sb1.c dev_sb1_io.c dev_sb1_pci.c hypervisor.c \
1.1.1.4 root 120: hv_nio.c hv_nio_bridge.c hv_frsw.c hv_atmsw.c hv_ethsw.c \
1.1.1.7 ! root 121: hv_vm.c hv_vm_debug.c \
! 122: hv_c7200.c hv_c3600.c hv_c2691.c hv_c3725.c hv_c3745.c
1.1 root 123:
124: # Profiling
125: #SOURCES += profiler.c
126: #CFLAGS += -p -DPROFILE -DPROFILE_FILE=\"$(PROG).profile\"
127:
1.1.1.3 root 128: ifeq ($(DYNAMIPS_ARCH),x86)
1.1 root 129: HDR += x86-codegen.h x86_trans.h
130: SOURCES += x86_trans.c
131: endif
132:
1.1.1.3 root 133: ifeq ($(DYNAMIPS_ARCH),amd64)
1.1 root 134: HDR += x86-codegen.h amd64-codegen.h amd64_trans.h
135: SOURCES += amd64_trans.c
136: endif
137:
1.1.1.3 root 138: ifeq ($(DYNAMIPS_ARCH),nojit)
1.1 root 139: HDR += nojit_trans.h
140: SOURCES += nojit_trans.c
141: endif
142:
143: # RAW Ethernet support for Linux
144: ifeq ($(shell uname), Linux)
145: CFLAGS += -DLINUX_ETH
146: HDR += linux_eth.h
147: SOURCES += linux_eth.c
148: endif
149:
1.1.1.2 root 150: # Generic Ethernet support with libpcap (0.9+)
151: ifeq ($(HAS_PCAP), 1)
152: CFLAGS += -DGEN_ETH
153: HDR += gen_eth.h
154: SOURCES += gen_eth.c
155:
156: LIBS += $(PCAP_LIB)
157: endif
158:
1.1.1.4 root 159: C_OBJS=$(SOURCES:.c=.o)
160: A_OBJS=$(ASMSRC:.S=.o)
1.1 root 161: LEX_C=$(LEX_SOURCES:.l=.c)
162:
1.1.1.7 ! root 163: SUPPL=mips_mts.c Makefile ChangeLog COPYING README README.hypervisor TODO \
! 164: dynamips.1 nvram_export.1 hypervisor_mode.7 microcode debian/
! 165:
1.1 root 166: FILE_LIST := $(HDR) $(SOURCES) $(SUPPL) \
1.1.1.7 ! root 167: x86-codegen.h x86_trans.c x86_trans.h \
1.1 root 168: amd64-codegen.h amd64_trans.c amd64_trans.h \
1.1.1.7 ! root 169: nojit_trans.c nojit_trans.h \
1.1.1.2 root 170: linux_eth.c linux_eth.h gen_eth.c gen_eth.h \
1.1.1.4 root 171: profiler.c profiler_resolve.pl bin2c.c rom2c.c \
172: nvram_export.c
173:
174: .PHONY: all
175: all: $(PROG) nvram_export
176:
1.1.1.7 ! root 177: $(PROG): microcode_dump.inc $(LEX_C) $(C_OBJS) $(A_OBJS)
1.1.1.4 root 178: @echo "Linking $@"
179: @$(CC) -o $@ $(C_OBJS) $(A_OBJS) $(LIBS)
180:
181: rom2c$(BIN_EXT): rom2c.c
182: @echo "Linking $@"
183: @$(CC) -Wall $(CFLAGS) -o $@ rom2c.c $(LIBS)
1.1 root 184:
1.1.1.4 root 185: microcode_dump.inc: rom2c$(BIN_EXT) microcode
186: @$(CC) -Wall $(CFLAGS) -o $@ rom2c.c $(LIBS)
1.1 root 187: @./rom2c microcode microcode_dump.inc
188:
1.1.1.4 root 189: asmdefs$(BIN_EXT): asmdefs.c mips64.h
190: @echo "Linking $@"
191: @$(CC) -Wall $(CFLAGS) -o $@ asmdefs.c
192:
193: asmdefs.h: asmdefs$(BIN_EXT)
194: @echo "Building assembly definitions header file"
195: @./asmdefs
196:
197: nvram_export$(BIN_EXT): nvram_export.c
198: @echo "Linking $@"
199: @$(CC) -Wall $(CFLAGS) -o $@ nvram_export.c
200:
1.1.1.7 ! root 201: install: $(PROG) nvram_export
! 202: @echo "Installing"
! 203: install -d $(DESTDIR)/bin $(DESTDIR)/man/man1 $(DESTDIR)/man/man7 $(DESTDIR)/etc
! 204: install dynamips nvram_export $(DESTDIR)/bin
! 205: install -m644 dynamips.1 $(DESTDIR)/man/man1
! 206: install -m644 nvram_export.1 $(DESTDIR)/man/man1
! 207: install -m644 hypervisor_mode.7 $(DESTDIR)/man/man7
! 208: # install -m644 example $(DESTDIR)/etc/dynamips
! 209:
! 210:
1.1 root 211: .PHONY: clean
212: clean:
1.1.1.4 root 213: $(RM) -f rom2c$(BIN_EXT) microcode_dump.inc asmdefs$(BIN_EXT) \
214: asmdefs.h $(C_OBJS) $(A_OBJS) $(PROG)
1.1 root 215: $(RM) -f *~
216:
217: .PHONY: package
218: package:
219: @mkdir -p distrib/$(PACKAGE)
1.1.1.7 ! root 220: @$(CP) -r $(FILE_LIST) distrib/$(PACKAGE)
1.1 root 221: @cd distrib ; $(TAR) czf $(ARCHIVE) $(PACKAGE)
222:
1.1.1.4 root 223: .PHONY: packdev
224: packdev:
225: @mkdir -p distrib/$(PACKAGE_DEV)
226: @$(CP) $(FILE_LIST) distrib/$(PACKAGE_DEV)
227: @cd distrib ; $(TAR) czf $(ARCHIVE_DEV) $(PACKAGE_DEV)
228:
229: .SUFFIXES: .c .h .S .l .y .o
230:
231: .S.o:
232: @echo "Assembling $<"
233: @$(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $<
1.1 root 234:
235: .c.o:
236: @echo "Compiling $<"
237: @$(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $<
238:
239: .l.c:
240: $(LEX) -o$*.c $<
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.