/[dynamips]/upstream/dynamips-0.2.5/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.5/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Sat Oct 6 16:01:44 2007 UTC (16 years, 5 months ago) by dpavlin
File size: 5607 byte(s)
import 0.2.5 from upstream

1 # Makefile for Dynamips 0.2.5
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=0.2.5
17 VERSION_DEV=$(VERSION)-$(shell date +%Y%m%d-%H)
18
19 # Executable binary extension
20 BIN_EXT?=
21
22 CC?=gcc
23 LD=ld
24 RM=rm
25 TAR=tar
26 CP=cp
27 LEX=flex
28 ARCH_INC_FILE=\"$(DYNAMIPS_ARCH)_trans.h\"
29 CFLAGS+=-g -Wall -O3 -fomit-frame-pointer \
30 -DJIT_ARCH=\"$(DYNAMIPS_ARCH)\" \
31 -DARCH_INC_FILE=$(ARCH_INC_FILE) -DDYNAMIPS_VERSION=\"$(VERSION)\" \
32 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
33 -DHAS_RFC2553=$(HAS_RFC2553)
34
35 PCAP_LIB=/usr/local/lib/libpcap.a
36 #PCAP_LIB=-lpcap
37
38 ifeq ($(shell uname), FreeBSD)
39 PTHREAD_LIBS?=-pthread
40 CFLAGS+=-I/usr/local/include -I/usr/local/include/libelf $(PTHREAD_CFLAGS)
41 LIBS=-L/usr/local/lib -L. -lelf $(PTHREAD_LIBS)
42 else
43 ifeq ($(shell uname -s), Darwin)
44 CFLAGS+=-I/usr/local/include -mdynamic-no-pic
45 LIBS=-L/usr/local/lib -L. -lelf -lpthread
46 else
47 ifeq ($(shell uname -o), Cygwin)
48 CFLAGS+=-I/usr/local/include -I/usr/local/include/libelf -DCYGWIN
49 LIBS=-L/usr/local/lib -L. -lelf -lpthread
50 PCAP_LIB=-lpacket -lwpcap
51 else
52 CFLAGS+=-I/usr/include/libelf
53 LIBS=-L. /usr/lib/libelf.a -lpthread
54 endif
55 endif
56 endif
57
58 PROG=dynamips$(BIN_EXT)
59 PACKAGE=$(PROG)-$(VERSION)
60 ARCHIVE=$(PACKAGE).tar.gz
61
62 PACKAGE_DEV=$(PROG)-$(VERSION_DEV)
63 ARCHIVE_DEV=$(PACKAGE_DEV).tar.gz
64
65 # Header and source files
66 HDR=mempool.h registry.h rbtree.h hash.h utils.h parser.h \
67 crc.h base64.h net.h net_io.h net_io_bridge.h net_io_filter.h \
68 atm.h frame_relay.h eth_switch.h \
69 ptask.h hypervisor.h dynamips.h insn_lookup.h \
70 vm.h mips64.h mips64_exec.h cpu.h cp0.h memory.h device.h \
71 nmc93c46.h cisco_eeprom.h ds1620.h pci_dev.h pci_io.h \
72 dev_dec21140.h dev_am79c971.h dev_mueslix.h \
73 dev_vtty.h dev_c7200.h dev_c3600.h dev_c3600_bay.h
74 SOURCES=mempool.c registry.c rbtree.c hash.c utils.c parser.c ptask.c \
75 crc.c base64.c net.c net_io.c net_io_bridge.c net_io_filter.c \
76 atm.c frame_relay.c eth_switch.c \
77 dynamips.c insn_lookup.c vm.c mips64.c mips64_jit.c mips64_exec.c \
78 cpu.c cp0.c memory.c device.c nmc93c46.c cisco_eeprom.c \
79 pci_dev.c pci_io.c \
80 dev_zero.c dev_vtty.c dev_ram.c dev_rom.c dev_nvram.c dev_bootflash.c \
81 dev_remote.c dev_clpd6729.c dev_pcmcia_disk.c dev_gt64k.c \
82 dev_plx9060.c dev_dec21x50.c dev_pericom.c dev_ap1011.c \
83 dev_ns16552.c dev_dec21140.c dev_am79c971.c dev_mueslix.c \
84 dev_c3600.c dev_c3600_bay.c dev_c3600_iofpga.c \
85 dev_c3600_eth.c dev_c3600_serial.c \
86 dev_c7200.c dev_c7200_iofpga.c dev_c7200_mpfpga.c \
87 dev_c7200_sram.c dev_c7200_eth.c dev_c7200_serial.c dev_c7200_pos.c \
88 dev_c7200_bri.c \
89 dev_pa_a1.c dev_sb1.c dev_sb1_io.c dev_sb1_pci.c hypervisor.c \
90 hv_nio.c hv_nio_bridge.c hv_frsw.c hv_atmsw.c hv_ethsw.c \
91 hv_vm.c hv_c7200.c hv_c3600.c
92
93 # Profiling
94 #SOURCES += profiler.c
95 #CFLAGS += -p -DPROFILE -DPROFILE_FILE=\"$(PROG).profile\"
96
97 ifeq ($(DYNAMIPS_ARCH),x86)
98 HDR += x86-codegen.h x86_trans.h
99 SOURCES += x86_trans.c
100 ASMSRC += x86_asm.S
101 CFLAGS += -DFAST_ASM
102 endif
103
104 ifeq ($(DYNAMIPS_ARCH),amd64)
105 HDR += x86-codegen.h amd64-codegen.h amd64_trans.h
106 SOURCES += amd64_trans.c
107 endif
108
109 ifeq ($(DYNAMIPS_ARCH),nojit)
110 HDR += nojit_trans.h
111 SOURCES += nojit_trans.c
112 endif
113
114 # RAW Ethernet support for Linux
115 ifeq ($(shell uname), Linux)
116 CFLAGS += -DLINUX_ETH
117 HDR += linux_eth.h
118 SOURCES += linux_eth.c
119 endif
120
121 # Generic Ethernet support with libpcap (0.9+)
122 ifeq ($(HAS_PCAP), 1)
123 CFLAGS += -DGEN_ETH
124 HDR += gen_eth.h
125 SOURCES += gen_eth.c
126
127 LIBS += $(PCAP_LIB)
128 endif
129
130 C_OBJS=$(SOURCES:.c=.o)
131 A_OBJS=$(ASMSRC:.S=.o)
132 LEX_C=$(LEX_SOURCES:.l=.c)
133
134 SUPPL=Makefile ChangeLog COPYING README README.hypervisor TODO \
135 dynamips.1 nvram_export.1 hypervisor_mode.7 microcode
136 FILE_LIST := $(HDR) $(SOURCES) $(SUPPL) \
137 x86-codegen.h x86_trans.c x86_trans.h x86_asm.S \
138 amd64-codegen.h amd64_trans.c amd64_trans.h \
139 nojit_trans.c nojit_trans.h asmdefs.c \
140 linux_eth.c linux_eth.h gen_eth.c gen_eth.h \
141 profiler.c profiler_resolve.pl bin2c.c rom2c.c \
142 nvram_export.c
143
144 .PHONY: all
145 all: $(PROG) nvram_export
146
147 $(PROG): microcode_dump.inc asmdefs.h $(LEX_C) $(C_OBJS) $(A_OBJS)
148 @echo "Linking $@"
149 @$(CC) -o $@ $(C_OBJS) $(A_OBJS) $(LIBS)
150
151 rom2c$(BIN_EXT): rom2c.c
152 @echo "Linking $@"
153 @$(CC) -Wall $(CFLAGS) -o $@ rom2c.c $(LIBS)
154
155 microcode_dump.inc: rom2c$(BIN_EXT) microcode
156 @$(CC) -Wall $(CFLAGS) -o $@ rom2c.c $(LIBS)
157 @./rom2c microcode microcode_dump.inc
158
159 asmdefs$(BIN_EXT): asmdefs.c mips64.h
160 @echo "Linking $@"
161 @$(CC) -Wall $(CFLAGS) -o $@ asmdefs.c
162
163 asmdefs.h: asmdefs$(BIN_EXT)
164 @echo "Building assembly definitions header file"
165 @./asmdefs
166
167 nvram_export$(BIN_EXT): nvram_export.c
168 @echo "Linking $@"
169 @$(CC) -Wall $(CFLAGS) -o $@ nvram_export.c
170
171 .PHONY: clean
172 clean:
173 $(RM) -f rom2c$(BIN_EXT) microcode_dump.inc asmdefs$(BIN_EXT) \
174 asmdefs.h $(C_OBJS) $(A_OBJS) $(PROG)
175 $(RM) -f *~
176
177 .PHONY: package
178 package:
179 @mkdir -p distrib/$(PACKAGE)
180 @$(CP) $(FILE_LIST) distrib/$(PACKAGE)
181 @cd distrib ; $(TAR) czf $(ARCHIVE) $(PACKAGE)
182
183 .PHONY: packdev
184 packdev:
185 @mkdir -p distrib/$(PACKAGE_DEV)
186 @$(CP) $(FILE_LIST) distrib/$(PACKAGE_DEV)
187 @cd distrib ; $(TAR) czf $(ARCHIVE_DEV) $(PACKAGE_DEV)
188
189 .SUFFIXES: .c .h .S .l .y .o
190
191 .S.o:
192 @echo "Assembling $<"
193 @$(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $<
194
195 .c.o:
196 @echo "Compiling $<"
197 @$(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $<
198
199 .l.c:
200 $(LEX) -o$*.c $<

  ViewVC Help
Powered by ViewVC 1.1.26