summaryrefslogtreecommitdiff
path: root/netware/phplib.mak
blob: 95026f2b1519b0ee9466cd1e303cd5654b1c82bf (plain)
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# Temporarily here -- later may go into some batch file
# which will set this as an environment variable
PROJECT_ROOT = .

# Module details
MODULE_NAME = phplib
MODULE_DESC = "PHP 4.3 - Script Interpreter and Library"
VMAJ = 3
VMIN = 0
VREV = 0

#include the common settings
include $(PROJECT_ROOT)/netware/common.mif


# Extensions of all input and output files
.SUFFIXES:
.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d

# Source files
C_SRC = ext/bcmath/bcmath.c \
        ext/bcmath/libbcmath/src/add.c \
        ext/bcmath/libbcmath/src/compare.c \
        ext/bcmath/libbcmath/src/debug.c \
        ext/bcmath/libbcmath/src/div.c \
        ext/bcmath/libbcmath/src/divmod.c \
        ext/bcmath/libbcmath/src/doaddsub.c \
        ext/bcmath/libbcmath/src/init.c \
        ext/bcmath/libbcmath/src/int2num.c \
        ext/bcmath/libbcmath/src/nearzero.c \
        ext/bcmath/libbcmath/src/neg.c \
        ext/bcmath/libbcmath/src/num2long.c \
        ext/bcmath/libbcmath/src/num2str.c \
        ext/bcmath/libbcmath/src/outofmem.c \
        ext/bcmath/libbcmath/src/output.c \
        ext/bcmath/libbcmath/src/raise.c \
        ext/bcmath/libbcmath/src/raisemod.c \
        ext/bcmath/libbcmath/src/recmul.c \
        ext/bcmath/libbcmath/src/rmzero.c \
        ext/bcmath/libbcmath/src/rt.c \
        ext/bcmath/libbcmath/src/sqrt.c \
        ext/bcmath/libbcmath/src/str2num.c \
        ext/bcmath/libbcmath/src/sub.c \
        ext/bcmath/libbcmath/src/zero.c \
        ext/calendar/cal_unix.c \
        ext/calendar/calendar.c \
        ext/calendar/dow.c \
        ext/calendar/easter.c \
        ext/calendar/french.c \
        ext/calendar/gregor.c \
        ext/calendar/jewish.c \
        ext/calendar/julian.c \
        ext/ftp/ftp.c \
        ext/ftp/php_ftp.c \
        ext/mcal/php_mcal.c \
        ext/pcre/php_pcre.c \
        ext/pcre/pcrelib/chartables.c \
        ext/pcre/pcrelib/get.c \
        ext/pcre/pcrelib/maketables.c \
        ext/pcre/pcrelib/pcre.c \
        ext/pcre/pcrelib/pcreposix.c \
        ext/pcre/pcrelib/study.c \
        ext/session/mod_files.c \
        ext/session/mod_mm.c \
        ext/session/mod_user.c \
        ext/session/session.c \
        ext/snmp/snmp.c \
        ext/standard/aggregation.c \
        ext/standard/array.c \
        ext/standard/assert.c \
        ext/standard/base64.c \
        ext/standard/basic_functions.c \
        ext/standard/browscap.c \
        ext/standard/crc32.c \
        ext/standard/credits.c \
        ext/standard/css.c \
        ext/standard/cyr_convert.c \
        ext/standard/datetime.c \
        ext/standard/dir.c \
        ext/standard/dl.c \
        ext/standard/dns.c \
        ext/standard/exec.c \
        ext/standard/file.c \
        ext/standard/filestat.c \
        ext/standard/filters.c \
        ext/standard/flock_compat.c \
        ext/standard/formatted_print.c \
        ext/standard/fsock.c \
        ext/standard/ftok.c \
        ext/standard/ftp_fopen_wrapper.c \
        ext/standard/head.c \
        ext/standard/html.c \
        ext/standard/http_fopen_wrapper.c \
        ext/standard/image.c \
        ext/standard/incomplete_class.c \
        ext/standard/info.c \
        ext/standard/iptc.c \
        ext/standard/lcg.c \
        ext/standard/levenshtein.c \
        ext/standard/link.c \
        ext/standard/mail.c \
        ext/standard/math.c \
        ext/standard/md5.c \
        ext/standard/metaphone.c \
        ext/standard/microtime.c \
        ext/standard/pack.c \
        ext/standard/pageinfo.c \
        ext/standard/parsedate.c \
        ext/standard/php_fopen_wrapper.c \
        ext/standard/quot_print.c \
        ext/standard/rand.c \
        ext/standard/reg.c \
        ext/standard/scanf.c \
        ext/standard/sha1.c \
        ext/standard/soundex.c \
        ext/standard/string.c \
        ext/standard/strnatcmp.c \
        ext/standard/type.c \
        ext/standard/uniqid.c \
        ext/standard/url.c \
        ext/standard/url_scanner.c \
        ext/standard/url_scanner_ex.c \
        ext/standard/user_filters.c \
        ext/standard/var.c \
        ext/standard/var_unserializer.c \
        ext/standard/versioning.c \
        main/fopen_wrappers.c \
        main/internal_functions_nw.c \
        main/main.c \
        main/memory_streams.c \
        main/mergesort.c \
        main/network.c \
        main/output.c \
        main/php_content_types.c \
        main/php_ini.c \
        main/php_logos.c \
        main/php_open_temporary_file.c \
        main/php_sprintf.c \
        main/php_ticks.c \
        main/php_variables.c \
        main/reentrancy.c \
        main/rfc1867.c \
        main/safe_mode.c \
        main/SAPI.c \
        main/snprintf.c \
        main/spprintf.c \
        main/streams.c \
        main/strlcat.c \
        main/strlcpy.c \
        main/user_streams.c \
        netware/geterrnoptr.c \
        netware/mktemp.c \
        netware/pipe.c \
        netware/pwd.c \
        netware/start.c \
        netware/time_nw.c \
        netware/wfile.c \
        regex/regcomp.c \
        regex/regerror.c \
        regex/regexec.c \
        regex/regfree.c \
#        ext/standard/crypt.c \
#        ext/com/COM.c \
#        ext/com/conversion.c \
#        ext/odbc/php_odbc.c \
#        ext/snmp/winsnmp.c \
#        netware/winutil.c \
#        netware/registry.c \
#        main/alloca.c \
#        ext/wddx/wddx.c \
#        netware/readdir.c \

WIN32_C_SRC = sendmail.c \


CPP_SRC_NODIR = $(notdir $(CPP_SRC))
C_SRC_NODIR = $(notdir $(C_SRC))
SRC_DIR = $(dir $(CPP_SRC) $(C_SRC))

# Library files
LIBRARY  = $(PROJECT_ROOT)/Zend/$(BUILD)/Zend.lib $(PROJECT_ROOT)/TSRM/$(BUILD)/TSRM.lib

# Destination directories and files
OBJ_DIR = $(BUILD)
FINAL_DIR = $(BUILD)
MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map
OBJECTS  = $(join $(SRC_DIR), $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj)))
WIN32_OBJECTS  = $(addprefix $(OBJ_DIR)/,$(WIN32_C_SRC:.c=.obj))
DEPDS  = $(join $(SRC_DIR), $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d)))

# Binary file
ifndef BINARY
	BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm
endif

# Compile flags
C_FLAGS += -c -maxerrors 25 -msgstyle gcc
C_FLAGS += -wchar_t on -bool on
C_FLAGS += -relax_pointers		# To remove type-casting errors
C_FLAGS += -processor Pentium
C_FLAGS += -nostdinc -nosyspath
C_FLAGS  += -DNETWARE -D__BIT_TYPES_DEFINED__ -DZTS
C_FLAGS  += -DPHP4DLLTS_EXPORTS -DPHP_EXPORTS -DLIBZEND_EXPORTS -DTSRM_EXPORTS -DSAPI_EXPORTS
C_FLAGS  += -DHAVE_SYS_TIME_H -DHAVE_STRUCT_FLOCK -DVIRTUAL_DIR -DHAVE_TZNAME
C_FLAGS  += -DHAVE_DLFCN_H -DHAVE_LIBDL
C_FLAGS  += -DCLIB_STAT_PATCH		# stat patch
C_FLAGS  += -DNEW_LIBC -DHAVE_ARPA_INET_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_INET_ATON=1

C_FLAGS  += -DLINK_SIZE=2		# Added for the new definition in ext\pcre\pcrelib\internal.h
# Below added for the file ext\pcre\pcrelib\pcreposix.c and
# the default value is what is defined in the changelog file
C_FLAGS  += -DPOSIX_MALLOC_THRESHOLD=5

C_FLAGS  += -I. -Imain -Inetware -Iregex -IZend -ITSRM
C_FLAGS  += -Iext/standard -Iext/mcal -Iext/pcre -Iext/pcre/pcrelib
C_FLAGS  += -Iext/bcmath -Iext/bcmath/libbcmath/src
C_FLAGS  += -Iext/odbc -Iext/session -Iext/ftp -Iext/wddx -Iext/calendar -Iext/snmp
C_FLAGS  += -I- -Inetware -I$(SDK_DIR)/include -I$(MWCIncludes)	# netware added for special SYS/STAT.H : Venkat(6/2/02)
C_FLAGS  += -Iwin32
C_FLAGS  += -I$(SDK_DIR)/include/winsock	# Added for socket calls


# Extra stuff based on debug / release builds
ifeq '$(BUILD)' 'debug'
	SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym
	C_FLAGS  += -inline smart -sym on -sym codeview4 -sym internal -opt off -opt intrinsics 
	C_FLAGS += -D_DEBUG -DZEND_DEBUG=1
	LD_FLAGS += -sym codeview4 -sym internal -osym $(SYM_FILE) 
	export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
else
	C_FLAGS  += -opt speed -inline on -inline auto -sym off -DZEND_DEBUG=0
	LD_FLAGS += -sym off
	export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
endif

# Dependencies
MODULE = LibC
IMPORT = @$(SDK_DIR)/imports/libc.imp   \
         @$(SDK_DIR)/imports/ws2nlm.imp \
         @$(MPK_DIR)/import/mpkOrg.imp
EXPORT = @$(PROJECT_ROOT)/netware/phplib.imp
API = NXGetEnvCount \
      NXCopyEnv \
      OutputToScreen \
      bsd_fd_set


# Virtual paths
vpath %.cpp .
vpath %.c . win32
vpath %.obj $(OBJ_DIR)


all: prebuild project

.PHONY: all

prebuild:
	@if not exist main\$(OBJ_DIR)                     md main\$(OBJ_DIR)
	@if not exist regex\$(OBJ_DIR)                    md regex\$(OBJ_DIR)
	@if not exist netware\$(OBJ_DIR)                  md netware\$(OBJ_DIR)
	@if not exist ext\standard\$(OBJ_DIR)             md ext\standard\$(OBJ_DIR)
	@if not exist ext\bcmath\$(OBJ_DIR)               md ext\bcmath\$(OBJ_DIR)
	@if not exist ext\bcmath\libbcmath\src\$(OBJ_DIR) md ext\bcmath\libbcmath\src\$(OBJ_DIR)
	@if not exist ext\mcal\$(OBJ_DIR)                 md ext\mcal\$(OBJ_DIR)
	@if not exist ext\pcre\$(OBJ_DIR)                 md ext\pcre\$(OBJ_DIR)
	@if not exist ext\pcre\pcrelib\$(OBJ_DIR)         md ext\pcre\pcrelib\$(OBJ_DIR)
	@if not exist ext\odbc\$(OBJ_DIR)                 md ext\odbc\$(OBJ_DIR)
	@if not exist ext\session\$(OBJ_DIR)              md ext\session\$(OBJ_DIR)
	@if not exist ext\ftp\$(OBJ_DIR)                  md ext\ftp\$(OBJ_DIR)
	@if not exist ext\wddx\$(OBJ_DIR)                 md ext\wddx\$(OBJ_DIR)
	@if not exist ext\calendar\$(OBJ_DIR)             md ext\calendar\$(OBJ_DIR)
	@if not exist ext\snmp\$(OBJ_DIR)                 md ext\snmp\$(OBJ_DIR)
	@if not exist $(FINAL_DIR)                        md $(FINAL_DIR)

project: $(BINARY) $(MESSAGE)
	@echo Build complete.

%.d: ../%.c
	@echo Building Dependencies for $(<F)
	@$(CC) -M $< $(C_FLAGS) -o $@
	
%.obj: ../%.c
	@echo Compiling $?...
# writing the flags to a file. Otherwise fails on win95 due too many characters in command line.
	@echo $(wordlist 1, 20, $(C_FLAGS)) > $(basename $(OBJ_DIR)\$(notdir $@)).cfg
	@echo $(wordlist 21, 40, $(C_FLAGS)) >> $(basename $(OBJ_DIR)\$(notdir $@)).cfg
	@echo $(wordlist 41, 60, $(C_FLAGS)) >> $(basename $(OBJ_DIR)\$(notdir $@)).cfg
	@echo $(wordlist 61, 80, $(C_FLAGS)) >> $(basename $(OBJ_DIR)\$(notdir $@)).cfg
	@$(CC) $< @$(basename $(OBJ_DIR)\$(notdir $@)).cfg -o $@ 
	@del $(basename $(OBJ_DIR)\$(notdir $@)).cfg


$(BINARY): $(OBJECTS) $(WIN32_OBJECTS) $(LIBRARY)
	@echo Import $(IMPORT) > $(basename $@).def
ifdef API
	@echo Import $(API) >> $(basename $@).def
endif
	@echo Module $(MODULE) >> $(basename $@).def
ifdef EXPORT
	@echo Export $(EXPORT) >> $(basename $@).def
endif
	@echo AutoUnload >> $(basename $@).def
ifeq '$(BUILD)' 'debug'
	@echo Debug >> $(basename $@).def
endif
	@echo Flag_On 0x00000008 >> $(basename $@).def
	@echo Start _LibCPrelude >> $(basename $@).def
	@echo Exit _LibCPostlude >> $(basename $@).def

	$(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc
	@echo xdcdata $(basename $@).xdc >> $(basename $@).def

	@echo Linking $@...
	@echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link
ifdef LIBRARY
	@echo $(LIBRARY) >> $(basename $@).link
endif
	@echo $(wordlist   1,  10, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist  11,  20, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist  21,  30, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist  31,  40, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist  41,  50, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist  51,  60, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist  61, 70, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist 71, 80, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist 81, 85, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist 86, 90, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist 91, 95, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist 96, 100, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist 101, 105, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist 106, 110, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist 111, 115, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist 116, 120, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist 121, 125, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist 126, 130, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist 131, 135, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist 136, 140, $(OBJECTS)) >> $(basename $@).link
	@echo $(wordlist 141, 141, $(OBJECTS)) >> $(basename $@).link

	@echo $(wordlist 1, 2, $(WIN32_OBJECTS)) >> $(basename $@).link

	@$(LINK) @$(basename $@).link


.PHONY: clean
clean: cleansrc cleanobj cleanbin

.PHONY: cleand
cleand:
	@echo Deleting all dependency files...
	-@del "main\$(OBJ_DIR)\*.d"
	-@del "regex\$(OBJ_DIR)\*.d"
	-@del "netware\$(OBJ_DIR)\*.d"
	-@del "ext\standard\$(OBJ_DIR)\*.d"
	-@del "ext\bcmath\$(OBJ_DIR)\*.d"
	-@del "ext\bcmath\libbcmath\src\$(OBJ_DIR)\*.d"
	-@del "ext\mcal\$(OBJ_DIR)\*.d"
	-@del "ext\pcre\$(OBJ_DIR)\*.d"
	-@del "ext\pcre\pcrelib\$(OBJ_DIR)\*.d"
	-@del "ext\odbc\$(OBJ_DIR)\*.d"
	-@del "ext\session\$(OBJ_DIR)\*.d"
	-@del "ext\ftp\$(OBJ_DIR)\*.d"
	-@del "ext\wddx\$(OBJ_DIR)\*.d"
	-@del "ext\calendar\$(OBJ_DIR)\*.d"
	-@del "ext\snmp\$(OBJ_DIR)\*.d"

.PHONY: cleansrc
cleansrc:
	@echo Deleting all generated source files...
	-@del "ext\standard\parsedate.c"
	-@del "ext\standard\parsedate.h"
	-@del "ext\standard\parsedate.output"

.PHONY: cleanobj
cleanobj:
	@echo Deleting all object files...
	-@del "main\$(OBJ_DIR)\*.obj"
	-@del "regex\$(OBJ_DIR)\*.obj"
	-@del "netware\$(OBJ_DIR)\*.obj"
	-@del "ext\standard\$(OBJ_DIR)\*.obj"
	-@del "ext\bcmath\$(OBJ_DIR)\*.obj"
	-@del "ext\bcmath\libbcmath\src\$(OBJ_DIR)\*.obj"
	-@del "ext\mcal\$(OBJ_DIR)\*.obj"
	-@del "ext\pcre\$(OBJ_DIR)\*.obj"
	-@del "ext\pcre\pcrelib\$(OBJ_DIR)\*.obj"
	-@del "ext\odbc\$(OBJ_DIR)\*.obj"
	-@del "ext\session\$(OBJ_DIR)\*.obj"
	-@del "ext\ftp\$(OBJ_DIR)\*.obj"
	-@del "ext\wddx\$(OBJ_DIR)\*.obj"
	-@del "ext\calendar\$(OBJ_DIR)\*.obj"
	-@del "ext\snmp\$(OBJ_DIR)\*.obj"

.PHONY: cleanbin
cleanbin:
	@echo Deleting binary files...
	-@del "$(FINAL_DIR)\$(MODULE_NAME).nlm"
	@echo Deleting MAP, DEF files, etc....
	-@del "$(FINAL_DIR)\$(MODULE_NAME).map"
	-@del "$(FINAL_DIR)\$(MODULE_NAME).def"
	-@del "$(FINAL_DIR)\$(MODULE_NAME).link"
ifeq '$(BUILD)' 'debug'
	-@del $(FINAL_DIR)\$(MODULE_NAME).sym
endif