summaryrefslogtreecommitdiffstats
path: root/pttbbs.mk
blob: 5473c999a6669dd59c845d8b57c101928dbd3947 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# $Id$
# 定義基本初值
BBSHOME?=   $(HOME)
BBSHOME?=   /home/bbs

SRCROOT?=   .

OSTYPE!=    uname

CC:=        gcc
CXX:=       g++
CCACHE!=    which ccache|sed -e 's/^.*\///'
.if $(CCACHE)
CC:=        ccache $(CC)
CXX:=       ccache $(CXX)
.endif

PTT_CFLAGS:=    -Wall -pipe -DBBSHOME='"$(BBSHOME)"' -I$(SRCROOT)/include
PTT_CXXFLAGS:=  -Wall -pipe -DBBSHOME='"$(BBSHOME)"' -I$(SRCROOT)/include
PTT_LDFLAGS:=
PTT_LDLIBS:=    -lhz

# enable assert()
#PTT_CFLAGS+=   -DNDEBUG 

.if ${OSTYPE} == "FreeBSD"
# FreeBSD特有的環境
PTT_CFLAGS+=    -I/usr/local/include
PTT_CXXFLAGS+=  -I/usr/local/include
PTT_LDFLAGS+=   -L/usr/local/lib
PTT_LDLIBS+=    -lkvm -liconv
.endif

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

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

.if defined(GDB)
CFLAGS:=    -g -O0 $(PTT_CFLAGS)
CXXFLAGS:=  -g -O0 $(PTT_CXXFLAGS)
LDFLAGS:=   -O0 $(PTT_LDFLAGS)
LDLIBS:=    $(PTT_LDLIBS)
.else
CFLAGS:=    -g -Os $(PTT_CFLAGS) $(EXT_CFLAGS)
CXXFLAGS:=  -g -Os $(PTT_CXXFLAGS) $(EXT_CXXFLAGS)
LDFLAGS:=   -Os $(PTT_LDFLAGS)
LDLIBS:=    $(PTT_LDLIBS)

.if defined(OMITFP)
CFLAGS+=    -fomit-frame-pointer
CXXFLAGS+=  -fomit-frame-pointer
.endif
.endif


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

######################################
# Settings for common libraries

# NetBSD pmake
MKLINT:=no
MKPROFILE:=no
MKPIC:=no
# Do not take warnings as errors
NOGCCERROR:=no

# FreeBSD make
WITHOUT_PROFILE:=yes

######################################

.MAIN: all

$(SRCROOT)/include/var.h:   $(SRCROOT)/mbbsd/var.c
    perl $(SRCROOT)/util/parsevar.pl < $(SRCROOT)/mbbsd/var.c > $(SRCROOT)/include/var.h