|
|
1.1 root 1: # Makefile for Dynamips 0.2.3
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: ARCH=x86
7:
8: # Change this to 0 if your system doesn't support RFC 2553 extensions
9: HAS_RFC2553=1
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)
! 13: HAS_PCAP=1
! 14:
1.1 root 15: # Current dynamips release
1.1.1.2 ! root 16: VERSION=0.2.3c
1.1 root 17:
18: CC=gcc
19: LD=ld
20: RM=rm
21: TAR=tar
22: CP=cp
23: LEX=flex
24: ARCH_INC_FILE=\"$(ARCH)_trans.h\"
25: CFLAGS=-g -Wall -O3 -fomit-frame-pointer -DJIT_ARCH=\"$(ARCH)\" \
26: -DARCH_INC_FILE=$(ARCH_INC_FILE) \
27: -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
28: -DHAS_RFC2553=$(HAS_RFC2553)
29:
1.1.1.2 ! root 30: PCAP_LIB=-lpcap
! 31:
1.1 root 32: ifeq ($(shell uname), FreeBSD)
33: CFLAGS+=-I/usr/local/include -I/usr/local/include/libelf
34: LIBS=-L/usr/local/lib -L. -lelf -pthread
35: else
1.1.1.2 ! root 36: ifeq ($(shell uname -s), Darwin)
! 37: CFLAGS+=-I/usr/local/include
! 38: LIBS=-L/usr/local/lib -L. -lelf -lpthread
! 39: else
1.1 root 40: ifeq ($(shell uname -o), Cygwin)
41: CFLAGS+=-I/usr/local/include -I/usr/local/include/libelf
42: LIBS=-L/usr/local/lib -L. -lelf -lpthread
1.1.1.2 ! root 43: PCAP_LIB=-lpacket -lwpcap
1.1 root 44: else
45: LIBS=-L. -lelf -lpthread
46: endif
47: endif
1.1.1.2 ! root 48: endif
1.1 root 49:
50: PROG=dynamips
51: PACKAGE=$(PROG)-$(VERSION)
52: ARCHIVE=$(PACKAGE).tar.gz
53:
54: # Header and source files
1.1.1.2 ! root 55: HDR=mempool.h cfg_lexer.h cfg_parser.h rbtree.h hash.h utils.h crc.h \
1.1 root 56: net.h net_io.h net_io_bridge.h atm.h \
57: ptask.h dynamips.h insn_lookup.h \
58: mips64.h mips64_exec.h cpu.h cp0.h memory.h device.h \
59: nmc93c46.h ds1620.h pci_dev.h pcireg.h \
60: dev_vtty.h dev_c7200.h dev_c7200_bay.h
1.1.1.2 ! root 61: SOURCES=mempool.c cfg_lexer.c cfg_parser.c rbtree.c hash.c utils.c crc.c \
1.1 root 62: net.c net_io.c net_io_bridge.c atm.c ptask.c \
63: dynamips.c insn_lookup.c mips64.c mips64_jit.c mips64_exec.c \
64: cpu.c cp0.c memory.c device.c nmc93c46.c pci_dev.c pci_io.c \
65: dev_zero.c dev_vtty.c dev_nvram.c dev_rom.c dev_bootflash.c \
66: dev_clpd6729.c dev_iofpga.c dev_mpfpga.c dev_gt64k.c \
67: dev_dec21x50.c dev_pericom.c \
68: dev_c7200.c dev_c7200_bay.c dev_c7200_sram.c dev_dec21140.c \
69: dev_c7200_serial.c dev_pa_a1.c \
70: dev_sb1_duart.c
71:
72: # Profiling
73: #SOURCES += profiler.c
74: #CFLAGS += -p -DPROFILE -DPROFILE_FILE=\"$(PROG).profile\"
75:
76: ifeq ($(ARCH),x86)
77: HDR += x86-codegen.h x86_trans.h
78: SOURCES += x86_trans.c
79: endif
80:
81: ifeq ($(ARCH),amd64)
82: HDR += x86-codegen.h amd64-codegen.h amd64_trans.h
83: SOURCES += amd64_trans.c
84: endif
85:
86: ifeq ($(ARCH),nojit)
87: HDR += nojit_trans.h
88: SOURCES += nojit_trans.c
89: endif
90:
91: # RAW Ethernet support for Linux
92: ifeq ($(shell uname), Linux)
93: CFLAGS += -DLINUX_ETH
94: HDR += linux_eth.h
95: SOURCES += linux_eth.c
96: endif
97:
1.1.1.2 ! root 98: # Generic Ethernet support with libpcap (0.9+)
! 99: ifeq ($(HAS_PCAP), 1)
! 100: CFLAGS += -DGEN_ETH
! 101: HDR += gen_eth.h
! 102: SOURCES += gen_eth.c
! 103:
! 104: LIBS += $(PCAP_LIB)
! 105: endif
! 106:
1.1 root 107: LEX_SOURCES=cfg_lexer.l
108:
109: OBJS=$(SOURCES:.c=.o)
110: LEX_C=$(LEX_SOURCES:.l=.c)
111:
112: SUPPL=Makefile ChangeLog README TODO microcode
113: FILE_LIST := $(HDR) $(SOURCES) $(SUPPL) \
114: x86-codegen.h x86_trans.c x86_trans.h \
115: amd64-codegen.h amd64_trans.c amd64_trans.h \
1.1.1.2 ! root 116: nojit_trans.c nojit_trans.h \
! 117: linux_eth.c linux_eth.h gen_eth.c gen_eth.h \
1.1 root 118: cfg_lexer.l profiler.c profiler_resolve.pl bin2c.c rom2c.c
119:
120: dynamips: microcode $(LEX_C) $(OBJS)
121: @echo "Linking $(PROG)"
122: @$(CC) -o $(PROG) $(OBJS) $(LIBS)
123:
124: .PHONY: microcode
125: microcode:
126: @$(CC) -Wall -o rom2c rom2c.c $(LIBS)
127: @./rom2c microcode microcode_dump.inc
128:
129: .PHONY: clean
130: clean:
131: $(RM) -f microcode_dump.inc $(OBJS) $(PROG)
132: $(RM) -f *~
133:
134: .PHONY: package
135: package:
136: @mkdir -p distrib/$(PACKAGE)
137: @$(CP) $(FILE_LIST) distrib/$(PACKAGE)
138: @cd distrib ; $(TAR) czf $(ARCHIVE) $(PACKAGE)
139:
140: .SUFFIXES: .c .h .l .y .o
141:
142: .c.o:
143: @echo "Compiling $<"
144: @$(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $<
145:
146: .l.c:
147: $(LEX) -o$*.c $<
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.