-
Notifications
You must be signed in to change notification settings - Fork 12
/
makefile.bc
209 lines (160 loc) · 4.62 KB
/
makefile.bc
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# $Id: makefile.bc,v 1.15.2.6 2013/12/13 16:40:26 alkresin Exp $
# makefile for Borland C/C++ 32 bits
# useful for building the RDD lib for xHarbour, needs BCC >= v5.8.2 as v5.5 fails with LZ4
.AUTODEPEND
# adapt ! if HB_PATH/ executable is still not set as root path of harbour:
HRB_DIR = $(HB_PATH)
HRB_EXE = $(HRB_DIR)\bin\$(HARBOUR_EXE)
# comment next line for not using LZ4 dummy functions aka with encrypted (needs compressed) traffic
USE_LZ4_DUMMY = yes
# ------
# needs a special build multi-thread executable - still don't know how for xHarbour
# check 'test_file' example for RTE * MUST * happen at end - then permanently comment it out
USE_SINGLE_SOCKET = yes
# xHarbour NOT yet uncomment next line if you want to build letodbf client lib with BMDBF* support
# __BM = yes
!if !$d(ECHO)
ECHO = echo.
!endif
!if !$d(DEL)
DEL = del
!endif
HARBOUR_LIBS = debug.lib vm.lib rtl.lib $(HB_GT_LIB) lang.lib rdd.lib macro.lib pp.lib common.lib codepage.lib pcrepos.lib
HARBOUR_LIBS = $(HARBOUR_LIBS) dbfntx.lib dbfcdx.lib dbffpt.lib hbsix.lib
CC = BCC32
LINKER = TLIB
# This is needed, otherwise the libs may overflow when
# debug info is requested with -v -y
# if debug info is requested, set ARFLAGS to /P64 in your environment
!if !$d(ARFLAGS)
ARFLAGS = /0
!endif
!if !$d(BCC_NOOPTIM)
CFLAGS = -O2 $(CFLAGS)
!endif
#
# Directory macros. These should never have to change.
##
LETO_LIB_DIR = lib
INCLUDE_DIR = include;$(HRB_DIR)\include;C:\BCC58\include;
CLIENT_DIR = source\client
COMMON_DIR = source\common
LZ4_DIR = source\3rd\lz4\lib
OBJ_DIR = obj\bcc
API_DIR = obj\api
#
# C compiler definition and C flags. These should never have to change.
#
CFLAGS = -I$(INCLUDE_DIR) -I$(LZ4_DIR) -d $(C_USR) $(CFLAGS) -tWM -D__WIN32__
CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS)
CLIBFLAGSDEBUG = -v $(CLIBFLAGS)
HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w3 -es2 -dUSE_LZ4 $(HARBOURFLAGS)
LDFLAGS = $(LDFLAGS)
!if $d(USE_SINGLE_SOCKET)
SINGLESOCKET = -DLETO_NO_THREAD=1
!endif
!if $d(USE_LZ4_DUMMY)
LZ4_DUMMY = -DLZ4_DUMMY
!endif
!if $d(__BM)
CLIBFLAGS = $(CLIBFLAGS) -D__BM
HARBOURFLAGS = $(HARBOURFLAGS) -D__BM
!endif
!if ! $d(HB_MT)
CLIBFLAGS = $(CLIBFLAGS) $(SINGLETHREAD)
!endif
CLIBFLAGS = $(CLIBFLAGS) $(LZ4_DUMMY) $(SINGLESOCKET) -D__NO_LZ4_WARN__ -DUSE_LZ4 -DUSE_PMURHASH=1 -DLETO_NO_MT=1
CAPIFLAGS = $(CLIBFLAGS) $(LZ4_DUMMY) $(SINGLESOCKET) -D__NO_LZ4_WARN__ -DUSE_LZ4 -DUSE_PMURHASH=1 -D__LETO_C_API__=1 -DLETO_NO_MT=1
CC_CMD = $(CC) $(CLIBFLAGS) -o$@ $**
CC_API = $(CC) $(CAPIFLAGS) -o$@ $**
CC_LZ4 = $(CC) $(CLIBFLAGS) -o$@ $**
HB_CMD = $(HRB_EXE) $(HARBOURFLAGS) $** -o$@
#
# Macros to access our library names
#
CLIENT_RDD_LIB = $(LETO_LIB_DIR)\rddleto.lib
CLIENT_LIB = $(LETO_LIB_DIR)\leto.lib
#
# RDDLETO.LIB rules
#
CLIENT_RDD_LIB_OBJS = \
$(OBJ_DIR)\letocl.obj \
$(OBJ_DIR)\leto1.obj \
$(OBJ_DIR)\letomgmn.obj \
$(OBJ_DIR)\common_c.obj \
$(OBJ_DIR)\blowfish.obj \
$(OBJ_DIR)\PMurHash.obj \
$(OBJ_DIR)\rddsys.obj \
$(OBJ_DIR)\lz4net.obj
!if ! $d(USE_LZ4_DUMMY)
CLIENT_RDD_LIB_OBJS = $(CLIENT_RDD_LIB_OBJS) \
$(OBJ_DIR)\lz4.obj
!endif
!if $d(__BM)
CLIENT_RDD_LIB_OBJS = $(CLIENT_RDD_LIB_OBJS) \
$(OBJ_DIR)\letobmcl.obj
!endif
#
# LETO.LIB rules
#
CLIENT_LIB_OBJS = \
$(API_DIR)\letocl.obj \
$(API_DIR)\common_c.obj \
$(API_DIR)\blowfish.obj \
$(API_DIR)\PMurHash.obj \
$(API_DIR)\lz4net.obj
!if ! $d(USE_LZ4_DUMMY)
CLIENT_LIB_OBJS = $(CLIENT_LIB_OBJS) \
$(API_DIR)\lz4.obj
!endif
#
# Our default target
#
PROJECT = \
$(CLIENT_RDD_LIB) \
$(CLIENT_LIB)
rdd: $(CLIENT_RDD_LIB)
api: $(CLIENT_LIB)
all: $(PROJECT)
#
# Library dependencies and build rules
#
$(CLIENT_RDD_LIB) : $(CLIENT_RDD_LIB_OBJS)
IF EXIST "$(CLIENT_RDD_LIB)" $(DEL) "$(CLIENT_RDD_LIB)" > NUL
$(LINKER) "$(CLIENT_RDD_LIB)" $(ARFLAGS) @&&!
+$(**: = &^
+)
!
$(CLIENT_LIB) : $(CLIENT_LIB_OBJS)
IF EXIST "$(CLIENT_LIB)" $(DEL) "$(CLIENT_LIB)" > NUL
$(LINKER) "$(CLIENT_LIB)" $(ARFLAGS) @&&!
+$(**: = &^
+)
!
# ---------------------------
# CLIENT_RDD.LIB Dependencies
# ---------------------------
{$(CLIENT_DIR)}.prg{$(OBJ_DIR)}.c:
$(HB_CMD)
.c.obj:
$(CC_CMD)
{$(CLIENT_DIR)}.c{$(OBJ_DIR)}.obj:
$(CC_CMD)
{$(COMMON_DIR)}.c{$(OBJ_DIR)}.obj:
$(CC_CMD)
{$(LZ4_DIR)}.c{$(OBJ_DIR)}.obj:
$(CC_LZ4)
# ---------------------------
# CLIENT.LIB Dependencies
# ---------------------------
.c.obj:
$(CC_API)
{$(CLIENT_DIR)}.c{$(API_DIR)}.obj:
IF EXIST "$@" $(DEL) $@
$(CC_API)
{$(COMMON_DIR)}.c{$(API_DIR)}.obj:
IF EXIST "$@" $(DEL) $@
$(CC_API)
{$(LZ4_DIR)}.c{$(API_DIR)}.obj:
IF EXIST "$@" $(DEL) $@
$(CC_LZ4)