--- cf/Makefile 2018/04/24 18:11:31 1.1.1.13 +++ cf/Makefile 2018/04/24 18:15:30 1.1.1.15 @@ -1,11 +1,14 @@ # Makefile for Dynamips 0.2.8 # Copyright (c) 2005-2006 Christophe Fillot. -# Replace x86 by amd64 for a build on x86_64. -# Use "nojit" for architectures that are not x86 or x86_64. -DYNAMIPS_ARCH?=x86 +# Host CPU selection +# - Use "x86" for a build on x86 (32-bits) +# - Use "amd64" for a build on x86_64 (64-bits) +# - Use "ppc32" for a build on powerpc (32-bits) +# - Use "nojit" for unsupported architectures. +DYNAMIPS_ARCH?=amd64 -# Change this to 0 if your system doesn't support RFC 2553 extensions +# Change this to 0 if your system doesn't support RFC2553 extensions HAS_RFC2553?=1 # Change this to 1 if your system has libpcap-0.9.4 or better @@ -13,11 +16,11 @@ HAS_RFC2553?=1 HAS_PCAP?=1 # Change this to 1 if your system has posix_memalign -HAS_POSIX_MEMALIGN?=0 +HAS_POSIX_MEMALIGN?=1 # Current dynamips release VERSION_TRAIN=0.2.8 -VERSION_SUB=-RC1 +VERSION_SUB=-RC3 VERSION=$(VERSION_TRAIN)$(VERSION_SUB) VERSION_DEV=$(VERSION_TRAIN)-$(shell date +%Y%m%d-%H) @@ -34,8 +37,9 @@ CP=cp LEX=flex MIPS64_ARCH_INC_FILE=\"mips64_$(DYNAMIPS_ARCH)_trans.h\" PPC32_ARCH_INC_FILE=\"ppc32_$(DYNAMIPS_ARCH)_trans.h\" +OSNAME=unknown -CFLAGS+=-g -Wall -O3 -fomit-frame-pointer \ +CFLAGS+=-m32 -g -Wall -O3 -fomit-frame-pointer \ -DJIT_ARCH=\"$(DYNAMIPS_ARCH)\" -DJIT_CPU=CPU_$(DYNAMIPS_ARCH) \ -DMIPS64_ARCH_INC_FILE=$(MIPS64_ARCH_INC_FILE) \ -DPPC32_ARCH_INC_FILE=$(PPC32_ARCH_INC_FILE) \ @@ -50,6 +54,7 @@ PCAP_LIB=-lpcap ifeq ($(shell uname), FreeBSD) PTHREAD_LIBS?=-pthread LOCALBASE?=/usr/local + OSNAME=FreeBSD CFLAGS+=-I$(LOCALBASE)/include -I$(LOCALBASE)/include/libelf \ $(PTHREAD_CFLAGS) -D_FILE_OFFSET_BITS=64 LIBS=-L$(LOCALBASE)/lib -L. -ldl -lelf $(PTHREAD_LIBS) $(LDFLAGS) @@ -57,15 +62,22 @@ else ifeq ($(shell uname), Linux) PTHREAD_LIBS?=-lpthread # PCAP_LIB=-lpcap + OSNAME=Linux CFLAGS+=-I/usr/include -I. $(PTHREAD_CFLAGS) - LIBS=-L/usr/lib -L. -ldl /usr/lib/libelf.a $(PTHREAD_LIBS) + LIBS=-L/usr/lib -L. -ldl /usr/lib/libuuid.a /usr/lib/libelf.a $(PTHREAD_LIBS) DESTDIR=/usr else ifeq ($(shell uname -s), Darwin) + OSNAME=Darwin CFLAGS+=-I/usr/local/include -mdynamic-no-pic -D_FILE_OFFSET_BITS=64 - LIBS=-L/usr/local/lib -L. -ldl -lelf -lpthread + LIBS=/usr/local/lib/libelf32.a + +# To use for prod: +# LIBS=-L/usr/local/lib -L. -ldl -lelf -lpthread +# LIBS=-L/usr/local/ppc/lib -L. -ldl -lelf -pthread else ifeq ($(shell uname -s), SunOS) + OSNAME=SunOS CFLAGS+=-I/usr/local/include -DINADDR_NONE=0xFFFFFFFF \ -I /opt/csw/include -DSUNOS LIBS=-L/usr/local/lib -L. -ldl -lelf -lpthread -L/opt/csw/lib \ @@ -73,6 +85,7 @@ ifeq ($(shell uname -s), SunOS) PCAP_LIB=/opt/csw/lib/libpcap.a else ifeq ($(shell uname -o), Cygwin) + OSNAME=Windows CFLAGS+=-I/usr/local/include -I/usr/local/include/libelf -DCYGWIN \ -D_FILE_OFFSET_BITS=64 LIBS=-L/usr/local/lib -L. -lelf -lpthread @@ -86,6 +99,8 @@ endif endif endif +CFLAGS+=-DOSNAME=$(OSNAME) + PROG=dynamips$(BIN_EXT) PACKAGE=$(PROG)-$(VERSION) ARCHIVE=$(PACKAGE).tar.gz @@ -95,13 +110,14 @@ ARCHIVE_DEV=$(PACKAGE_DEV).tar.gz # Header and source files HDR=mempool.h registry.h rbtree.h hash.h utils.h parser.h plugin.h \ - crc.h sbox.h base64.h net.h net_io.h net_io_bridge.h net_io_filter.h \ - atm.h frame_relay.h eth_switch.h \ + gen_uuid.h crc.h sbox.h base64.h \ + net.h net_io.h net_io_bridge.h net_io_filter.h \ + atm.h atm_vsar.h atm_bridge.h frame_relay.h eth_switch.h \ ptask.h timer.h dev_vtty.h hypervisor.h dynamips.h insn_lookup.h \ - vm.h cpu.h jit_op.h memory.h device.h \ + vm.h cpu.h tcb.h jit_op.h memory.h device.h \ mips64.h mips64_mem.h mips64_exec.h mips64_jit.h mips64_cp0.h \ ppc32.h ppc32_mem.h ppc32_exec.h ppc32_jit.h ppc32_vmtest.h \ - nmc93cX6.h cisco_eeprom.h cisco_card.h ds1620.h dev_rom.h \ + nmc93cX6.h cisco_eeprom.h cisco_card.h dev_ds1620.h dev_rom.h \ pci_dev.h pci_io.h dev_mpc860.h dev_gt.h dev_mv64460.h dev_plx.h \ dev_dec21140.h dev_am79c971.h dev_i8254x.h dev_i8255x.h \ dev_mueslix.h dev_nm_16esw.h dev_wic_serial.h \ @@ -117,16 +133,16 @@ HDR=mempool.h registry.h rbtree.h hash.h rommon_var.h SOURCES=mempool.c registry.c rbtree.c hash.c sbox.c utils.c parser.c \ - plugin.c ptask.c timer.c crc.c base64.c \ + gen_uuid.c plugin.c ptask.c timer.c crc.c base64.c \ net.c net_io.c net_io_bridge.c net_io_filter.c \ - atm.c frame_relay.c eth_switch.c \ - dynamips.c insn_lookup.c vm.c cpu.c jit_op.c \ + atm.c atm_vsar.c atm_bridge.c frame_relay.c eth_switch.c \ + dynamips.c insn_lookup.c vm.c cpu.c tcb.c jit_op.c \ mips64.c mips64_mem.c mips64_cp0.c mips64_jit.c mips64_exec.c \ ppc32.c ppc32_mem.c ppc32_jit.c ppc32_exec.c ppc32_vmtest.c \ memory.c device.c nmc93cX6.c cisco_eeprom.c cisco_card.c \ pci_dev.c pci_io.c \ dev_zero.c dev_bswap.c dev_vtty.c dev_ram.c dev_rom.c dev_nvram.c \ - dev_bootflash.c dev_flash.c dev_mpc860.c \ + dev_bootflash.c dev_flash.c dev_mpc860.c dev_ds1620.c \ dev_remote.c dev_clpd6729.c dev_pcmcia_disk.c dev_gt.c dev_mv64460.c \ dev_plx.c dev_dec21x50.c dev_pericom.c dev_ti2050b.c dev_ap1011.c \ dev_plx6520cb.c dev_ns16552.c \ @@ -136,7 +152,7 @@ SOURCES=mempool.c registry.c rbtree.c ha dev_c3600_eth.c dev_c3600_serial.c \ dev_c7200.c dev_c7200_iofpga.c dev_c7200_mpfpga.c \ dev_c7200_sram.c dev_c7200_eth.c dev_c7200_serial.c dev_c7200_pos.c \ - dev_c7200_bri.c \ + dev_c7200_bri.c dev_c7200_jcpa.c \ dev_c2691.c dev_c2691_iofpga.c dev_c2691_eth.c dev_c2691_serial.c \ dev_c2691_wic.c dev_c2691_pcmod.c \ dev_c3725.c dev_c3725_iofpga.c dev_c3725_eth.c dev_c3725_serial.c \ @@ -150,8 +166,9 @@ SOURCES=mempool.c registry.c rbtree.c ha dev_c6sup1.c dev_c6sup1_iofpga.c dev_c6sup1_mpfpga.c \ dev_nm_16esw.c dev_pa_a1.c dev_pa_mc8te1.c \ dev_sb1.c dev_sb1_io.c dev_sb1_pci.c hypervisor.c \ - hv_nio.c hv_nio_bridge.c hv_frsw.c hv_atmsw.c hv_ethsw.c \ - hv_vm.c hv_vm_debug.c \ + hv_nio.c hv_nio_bridge.c \ + hv_frsw.c hv_atmsw.c hv_atm_bridge.c hv_ethsw.c \ + hv_vm.c hv_vm_debug.c hv_store.c \ hv_c7200.c hv_c3600.c hv_c2691.c hv_c3725.c hv_c3745.c \ hv_c2600.c hv_c1700.c \ rommon_var.c @@ -163,11 +180,19 @@ SOURCES=mempool.c registry.c rbtree.c ha ifeq ($(DYNAMIPS_ARCH),x86) HDR += x86-codegen.h mips64_x86_trans.h ppc32_x86_trans.h SOURCES += mips64_x86_trans.c ppc32_x86_trans.c +CFLAGS += -m32 endif ifeq ($(DYNAMIPS_ARCH),amd64) HDR += x86-codegen.h amd64-codegen.h mips64_amd64_trans.h ppc32_amd64_trans.h SOURCES += mips64_amd64_trans.c ppc32_amd64_trans.c +CFLAGS += -m64 +endif + +ifeq ($(DYNAMIPS_ARCH),ppc32) +HDR += mips64_ppc32_trans.h ppc32_ppc32_trans.h +SOURCES += mips64_ppc32_trans.c ppc32_ppc32_trans.c +CFLAGS += -m32 endif ifeq ($(DYNAMIPS_ARCH),nojit) @@ -200,13 +225,14 @@ SUPPL=mips_mts.c Makefile ChangeLog COPY mips64_microcode ppc32_microcode debian/ FILE_LIST := $(HDR) $(SOURCES) $(SUPPL) \ - x86-codegen.h amd64-codegen.h \ + x86-codegen.h amd64-codegen.h ppc-codegen.h \ mips64_x86_trans.c mips64_x86_trans.h \ mips64_amd64_trans.c mips64_amd64_trans.h \ mips64_nojit_trans.c mips64_nojit_trans.h \ ppc32_x86_trans.c ppc32_x86_trans.h \ ppc32_amd64_trans.c ppc32_amd64_trans.h \ ppc32_nojit_trans.c ppc32_nojit_trans.h \ + mips64_ppc32_trans.c mips64_ppc32_trans.h \ linux_eth.c linux_eth.h gen_eth.c gen_eth.h \ profiler.c profiler_resolve.pl bin2c.c rom2c.c \ nvram_export.c udp_send.c udp_recv.c @@ -217,15 +243,15 @@ all: $(PROG) nvram_export $(PROG): mips64_microcode_dump.inc ppc32_microcode_dump.inc \ $(LEX_C) $(C_OBJS) $(A_OBJS) @echo "Linking $@" - @$(CC) -o $@ $(C_OBJS) $(A_OBJS) $(LIBS) + @$(CC) $(CFLAGS) -o $@ $(C_OBJS) $(A_OBJS) $(LIBS) -udp_send$(BIN_EXT): udp_send.c net.c +udp_send$(BIN_EXT): udp_send.c net.c crc.c @echo "Linking $@" - @$(CC) -Wall $(CFLAGS) -o $@ udp_send.c net.c $(LIBS) + @$(CC) -Wall $(CFLAGS) -o $@ udp_send.c net.c crc.c $(LIBS) -udp_recv$(BIN_EXT): udp_recv.c net.c +udp_recv$(BIN_EXT): udp_recv.c net.c crc.c @echo "Linking $@" - @$(CC) -Wall $(CFLAGS) -o $@ udp_recv.c net.c $(LIBS) + @$(CC) -Wall $(CFLAGS) -o $@ udp_recv.c net.c crc.c $(LIBS) rom2c$(BIN_EXT): rom2c.c @echo "Linking $@"