summaryrefslogtreecommitdiffstats
path: root/pttbbs.mk
blob: 9df09196bf23284c0364edcfe378161c390135c3 (plain) (blame)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# $Id$
# 定義基本初值
BBSHOME?=   $(HOME)
BBSHOME?=   /home/bbs
OSTYPE!=    uname
CC?=        gcc
CCACHE!=    which ccache|sed -e 's/^.*\///'
PTT_CFLAGS= -Wall -pipe -DBBSHOME='"$(BBSHOME)"' -I../include
PTT_LDFLAGS=    -pipe -Wall -L/usr/local/lib
PTT_LIBS=   -lcrypt -lhz

# enable assert()
#PTT_CFLAGS+=   -DNDEBUG 

# FreeBSD特有的環境
CFLAGS_FreeBSD= -DHAVE_SETPROCTITLE -DFreeBSD -I/usr/local/include
LDFLAGS_FreeBSD=
LIBS_FreeBSD=   -lkvm -liconv

# Linux特有的環境
# CFLAGS_linux=   -DHAVE_DES_CRYPT -DLinux
CFLAGS_Linux=   
LDFLAGS_Linux=  -pipe -Wall 
LIBS_Linux= 

# CFLAGS, LDFLAGS, LIBS 加入 OS 相關參數
PTT_CFLAGS+=    $(CFLAGS_$(OSTYPE))
PTT_LDFLAGS+=   $(LDFLAGS_$(OSTYPE))
PTT_LIBS+=  $(LIBS_$(OSTYPE))

# 若有定義 PROFILING
.if defined(PROFILING)
PTT_CFLAGS+=    -pg
PTT_LDFLAGS+=   -pg
NO_OMITFP=  yes
NO_FORK=    yes
.endif

.if defined(USE_ICC)
CC=     icc
CFLAGS=     $(PTT_CFLAGS) -O1 -tpp6 -mcpu=pentiumpro -march=pentiumiii \
        -ip -ipo
LDFLAGS+=   -O1 -tpp6 -mcpu=pentiumpro -march=pentiumiii -ip -ipo \
        $(PTT_LDFLAGS) $(PTT_LIBS)
.else
# 若有定義 GDB或 DEBUG, 則加入 -g , 否則用 -O
.if defined(GDB) || defined(DEBUG)
CFLAGS=     -g $(PTT_CFLAGS)
LDFLAGS=    -g $(PTT_LDFLAGS) $(PTT_LIBS)
.else
CFLAGS+=    -Os -fstrength-reduce \
        -fthread-jumps -fexpensive-optimizations \
        $(PTT_CFLAGS) $(EXT_CFLAGS)
LDFLAGS+=   -Os $(PTT_LDFLAGS) $(PTT_LIBS)

.if !defined(NO_OMITFP)
CFLAGS+=    -fomit-frame-pointer
.endif
.endif
.endif

# 若有定義 DEBUG, 則在 CFLAGS內定義 DEBUG
.if defined(DEBUG)
CFLAGS+=    -DDEBUG
.endif

# 若有定義 NO_FORK, 則在 CFLAGS內定義 NO_FORK
.if defined(NO_FORK)
CFLAGS+=    -DNO_FORK
.endif