forked from XIA-Project/xia-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·46 lines (37 loc) · 889 Bytes
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
OUTPUT=xia.mk
echo "# Autogenerated on $(date)" > $OUTPUT
echo "# DO NOT HAND EDIT!" >> $OUTPUT
echo >> $OUTPUT
# set num of procs for parallel builds
if [ $(uname) = "Darwin" ]; then
# os x
CORES=$(sysctl -n hw.ncpu)
else
# linux
CORES=`grep -c ^processor /proc/cpuinfo`
fi
echo NPROCS=$(($CORES * 2)) >> $OUTPUT
echo XIADIR=$(pwd) >> $OUTPUT
[ "$1" == "DEBUG" ] && echo "DEBUG=1" >> $OUTPUT
cat >> $OUTPUT << EOF
APIDIR=\$(XIADIR)/api
BINDIR=\$(XIADIR)/bin
ETC=\$(XIADIR)/etc
XLIB=\$(APIDIR)/lib
XINC=\$(APIDIR)/include
CC=g++
LD=g++
CFLAGS=-Wall -Wextra -I\$(XINC)
LDFLAGS=-lpthread
ifeq (\$(wildcard \$(XLIB)/libXsocket.a),)
LIBS=\$(XLIB)/libXsocket.so \$(XLIB)/libdagaddr.so \$(XLIB)/libXssl.so
else
LIBS=\$(XLIB)/libXsocket.a \$(XLIB)/libdagaddr.a \$(XLIB)/libXssl.a -Bstatic -lprotobuf
endif
ifdef DEBUG
CFLAGS +=-ggdb -DDEBUG
else
CFLAGS +=-O2
endif
EOF