| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
ifndef ipv4only |
| 9 |
CXXOPT += -DIPv6RECV |
| 10 |
endif |
| 11 |
|
| 12 |
|
| 13 |
ifdef debug |
| 14 |
CXXOPT += -DDEBUG=$(debug) -ggdb |
| 15 |
else |
| 16 |
CXXOPT += -O2 |
| 17 |
endif |
| 18 |
|
| 19 |
|
| 20 |
ifdef multiport |
| 21 |
CXXOPT += -DMULTIPORT |
| 22 |
endif |
| 23 |
|
| 24 |
|
| 25 |
ifdef static |
| 26 |
CXXOPT += -static-libstdc++ -static-libgcc |
| 27 |
endif |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
VERSION=$(shell cat ../VERSION) |
| 34 |
REVISION=$(shell [ -d ../.svn ] && svnversion -n || cat ../REVISION) |
| 35 |
|
| 36 |
CXXOPT += -DVERSION="\"$(VERSION)\"" |
| 37 |
CXXOPT += -DREVISION="\"$(REVISION)\"" |
| 38 |
|
| 39 |
|
| 40 |
COMPONENTS = ITGSend ITGRecv ITGLog ITGDec libITG ITGManager |
| 41 |
|
| 42 |
|
| 43 |
export OS = WindowsNT |
| 44 |
export OSFLAGS = -DWIN32 |
| 45 |
export SUFFIX = .exe |
| 46 |
export SOSUFFIX = .dll |
| 47 |
|
| 48 |
export RM = rm -rf |
| 49 |
export CP = cp |
| 50 |
export MV = mv |
| 51 |
|
| 52 |
export BASEDIR = $(shell pwd) |
| 53 |
export BIN = $(shell dirname $(BASEDIR))/bin |
| 54 |
export COMMON = $(BASEDIR)/common/ |
| 55 |
export NRCLEAN = $(BASEDIR)/ITGSend/newran/ |
| 56 |
|
| 57 |
export THOBJS = common/thread.o |
| 58 |
export OBJS = common/ITG.o common/timestamp.o common/serial.o common/pipes.o |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
.PHONY: $(COMPONENTS) |
| 65 |
all: check head $(COMPONENTS) |
| 66 |
@ echo -e '\n----------------------------------------------------------' |
| 67 |
ifdef strip |
| 68 |
@ echo -n 'Stripping binaries...' |
| 69 |
@ $(PREFIX)-strip ../bin/*.exe ../bin/*.dll |
| 70 |
@ echo 'done' |
| 71 |
endif |
| 72 |
@ echo 'D-ITG executables created in $(BIN)' |
| 73 |
|
| 74 |
|
| 75 |
help: |
| 76 |
@ echo '----------------' |
| 77 |
@ echo 'Building options' |
| 78 |
@ echo '----------------' |
| 79 |
@ echo ' debug=<N> : enable debug mode using verbosity level N' |
| 80 |
@ echo ' ipv4only=on : disable support for IPv6 (only required on Windows XP to support IPv4)' |
| 81 |
@ echo ' multiport=on : enable support for receiving multiple flows on the same port number' |
| 82 |
@ echo ' static=on : statically include libstdc++ and libgcc' |
| 83 |
@ echo '-------------' |
| 84 |
@ echo 'Building tips' |
| 85 |
@ echo '-------------' |
| 86 |
@ echo ' - To build D-ITG with options use the following syntax:' |
| 87 |
@ echo ' make -f mingw.mk clean all [options]' |
| 88 |
|
| 89 |
|
| 90 |
head: |
| 91 |
@ echo -e '\n---------------------' |
| 92 |
@ echo 'Current configuration' |
| 93 |
@ echo '---------------------' |
| 94 |
@ echo -n 'Enabled features*: ' |
| 95 |
ifdef ipv4only |
| 96 |
@ echo -n 'ipv4only ' |
| 97 |
endif |
| 98 |
ifdef multiport |
| 99 |
@ echo -n 'multiport ' |
| 100 |
endif |
| 101 |
ifdef static |
| 102 |
@ echo -n 'static ' |
| 103 |
endif |
| 104 |
ifdef debug |
| 105 |
@ echo -n 'debug=$(debug) ' |
| 106 |
endif |
| 107 |
@ echo |
| 108 |
@ echo 'Version: $(VERSION)' |
| 109 |
@ echo 'Revision: $(REVISION)' |
| 110 |
@ echo 'Compiler: $(CXX)' |
| 111 |
@ echo 'OS: $(OS)' |
| 112 |
@ echo 'OS Flags: $(OSFLAGS)' |
| 113 |
@ echo '------------------------------------------------' |
| 114 |
@ echo '* Run "make help" for available options and tips' |
| 115 |
@ echo -e '\n---------------------' |
| 116 |
@ echo 'Building common files' |
| 117 |
@ echo '---------------------' |
| 118 |
|
| 119 |
|
| 120 |
check: |
| 121 |
@ echo -e '\n---------------------' |
| 122 |
@ echo 'Checking dependencies' |
| 123 |
@ echo '---------------------' |
| 124 |
ifdef MINGW |
| 125 |
@ $(eval PREFIX := $(shell echo "$(MINGW)" | awk -F/ '{ print $$NF ; exit }')) |
| 126 |
@ $(eval GWDIR := $(MINGW)) |
| 127 |
else |
| 128 |
@ echo 'Available MinGW environments:' |
| 129 |
@ find /usr -maxdepth 1 -name '*mingw*' | \ |
| 130 |
awk '{ if ($$0 ~ /x86_64/) { a="64bit" } else { a="32bit" } ; print "- " $$0 " ("a")"}' || echo "not found!" |
| 131 |
@ echo 'Note: *** only 32bit targets are currently supported ***' |
| 132 |
@ $(eval PREFIX := $(shell find /usr -maxdepth 1 -name '*mingw*' | awk -F/ '!/x86_64/{ print $$NF ; exit }')) |
| 133 |
@ $(eval GWDIR := /usr/$(PREFIX)) |
| 134 |
endif |
| 135 |
@ if [ $(PREFIX) ]; then \ |
| 136 |
echo 'Selected MinGW environment: $(GWDIR)' ;\ |
| 137 |
else \ |
| 138 |
echo 'Please set the MINGW variable to point to the MinGW toolchain path (e.g. MINGW=/usr/i586-mingw32msvc)' ;\ |
| 139 |
exit 1 ;\ |
| 140 |
fi |
| 141 |
@ $(eval export LDFLAGS = $(GWDIR)/lib/libws2_32.a) |
| 142 |
@ $(eval CXXINCS = -I"$(GWDIR)/include") |
| 143 |
@ $(eval LIBS = -L"$(GWDIR)/lib") |
| 144 |
@ $(eval INCS = -I"$(GWDIR)/include") |
| 145 |
@ $(eval CFLAGS = $(INCS)) |
| 146 |
@ $(eval export CXXFLAGS = $(CXXOPT) -Wall $(OSFLAGS) -D_WIN32_WINNT=0x0501 -Wno-deprecated -Wno-strict-aliasing $(CXXINCS)) |
| 147 |
@ $(eval export CXX = $(PREFIX)-c++) |
| 148 |
@ $(eval export CC = $(PREFIX)-gcc) |
| 149 |
@ $(eval export AR = $(PREFIX)-ar) |
| 150 |
@ $(eval export RANLIB = $(PREFIX)-ranlib) |
| 151 |
@ echo -n 'Compiler: ' |
| 152 |
@ which $(CXX) || { echo "$(CXX) not in the PATH!" ; exit 1 ; } |
| 153 |
@ echo '(To select a different environment set the MINGW variable (e.g. MINGW=/usr/i586-mingw32msvc)' |
| 154 |
|
| 155 |
|
| 156 |
clean: |
| 157 |
@ echo '----------------' |
| 158 |
@ echo 'Cleaning sources' |
| 159 |
@ echo '----------------' |
| 160 |
@ echo -n 'Cleaning common files...' |
| 161 |
@ $(RM) $(COMMON)/*.o |
| 162 |
@ echo 'done' |
| 163 |
@ for c in ITGSend ITGRecv ITGLog ITGDec libITG ITGManager; do \ |
| 164 |
echo -n "Cleaning $${c}..." ;\ |
| 165 |
make -C $${c} --no-print-directory clean ;\ |
| 166 |
echo 'done' ;\ |
| 167 |
done |
| 168 |
|
| 169 |
$(COMPONENTS): $(THOBJS) $(OBJS) |
| 170 |
@ echo -e '\n-------------------' |
| 171 |
@ echo 'Building $@' |
| 172 |
@ echo '-------------------' |
| 173 |
@ $(MAKE) -C $@ --no-print-directory |
| 174 |
|
| 175 |
|
| 176 |
include common.mk |
| 177 |
|
| 178 |
|
| 179 |
|