xref: /PHP-5.5/ext/mysql/mysql.mak (revision 0a34d107)
1# Temporarily here -- later may go into some batch file
2# which will set this as an environment variable
3PROJECT_ROOT = ..\..
4
5# Module details
6MODULE_NAME = phpmysql
7MODULE_DESC = "PHP 4.3 - MySQL Extension"
8VMAJ = 3
9VMIN = 0
10VREV = 0
11
12#include the common settings
13include $(PROJECT_ROOT)/netware/common.mif
14
15# MYSQL stuff
16MYSQL_DIR = P:/APPS/script/sw/mysql
17
18# Build type defaults to 'release'
19ifndef BUILD
20BUILD = release
21endif
22
23# Extensions of all input and output files
24.SUFFIXES:
25.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
26
27# Source files
28C_SRC = php_mysql.c \
29        start.c
30
31CPP_SRC_NODIR = $(notdir $(CPP_SRC))
32C_SRC_NODIR = $(notdir $(C_SRC))
33SRC_DIR = $(dir $(CPP_SRC) $(C_SRC))
34
35# Library files
36LIBRARY = $(MYSQL_DIR)/lib/libmysqlclient.lib
37
38# Destination directories and files
39OBJ_DIR = $(BUILD)
40FINAL_DIR = $(BUILD)
41OBJECTS  = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj))
42DEPDS  = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d))
43
44# Binary file
45ifndef BINARY
46	BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm
47endif
48
49# Compile flags
50C_FLAGS  = -c -maxerrors 25 -msgstyle gcc -wchar_t on -bool on -processor Pentium
51C_FLAGS += -nostdinc -nosyspath
52C_FLAGS += -relax_pointers		# To remove type-casting errors
53C_FLAGS += -DNETWARE -DZTS -DNEW_LIBC -DUSE_OLD_FUNCTIONS -DCOMPILE_DL_MYSQL=1
54C_FLAGS += -I. -I- -I$(PROJECT_ROOT) -I$(PROJECT_ROOT)/main
55C_FLAGS += -I$(PROJECT_ROOT)/ext/standard -I$(PROJECT_ROOT)/netware
56C_FLAGS += -I$(PROJECT_ROOT)/zend -I$(PROJECT_ROOT)/tsrm
57C_FLAGS += -I$(SDK_DIR)/include -I$(MWCIncludes)
58C_FLAGS += -I$(MYSQL_DIR)/include
59C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include
60
61
62# Extra stuff based on debug / release builds
63ifeq '$(BUILD)' 'debug'
64	SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym
65	C_FLAGS  += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -DDEBUGGING -DDKFBPON
66	C_FLAGS += -exc cw -DZEND_DEBUG=1
67	LD_FLAGS += -sym on -sym codeview4 -osym $(SYM_FILE)
68	export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
69else
70	C_FLAGS  += -opt speed -inline on -inline smart -inline auto -sym off -opt intrinsics
71	C_FLAGS += -opt level=4 -DZEND_DEBUG=0
72	LD_FLAGS += -sym off
73	export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
74endif
75
76
77# Dependencies
78MODULE = LibC    \
79         phplib
80IMPORT = @$(SDK_DIR)/imports/libc.imp        \
81         @$(SDK_DIR)/imports/ws2nlm.imp      \
82         @$(MPK_DIR)/import/mpkOrg.imp       \
83         @$(PROJECT_ROOT)/netware/phplib.imp
84EXPORT = ($(MODULE_NAME)) get_module
85API = OutputToScreen
86
87# Virtual paths
88vpath %.cpp .
89vpath %.c . ..\..\netware
90vpath %.obj $(OBJ_DIR)
91
92
93all: prebuild project
94
95.PHONY: all
96
97prebuild:
98	@if not exist $(OBJ_DIR) md $(OBJ_DIR)
99
100project: $(BINARY)
101	@echo Build complete.
102
103$(OBJ_DIR)/%.d: %.cpp
104	@echo Building Dependencies for $(<F)
105	@$(CC) -M $< $(C_FLAGS) -o $@
106
107$(OBJ_DIR)/%.d: %.c
108	@echo Building Dependencies for $(<F)
109	@$(CC) -M $< $(C_FLAGS) -o $@
110
111$(OBJ_DIR)/%.obj: %.cpp
112	@echo Compiling $?...
113	@$(CC) $< $(C_FLAGS) -o $@
114
115$(OBJ_DIR)/%.obj: %.c
116	@echo Compiling $?...
117	@$(CC) $< $(C_FLAGS) -o $@
118
119
120$(BINARY): $(OBJECTS)
121	@echo Import $(IMPORT) > $(basename $@).def
122ifdef API
123	@echo Import $(API) >> $(basename $@).def
124endif
125	@echo Module $(MODULE) >> $(basename $@).def
126ifdef EXPORT
127	@echo Export $(EXPORT) >> $(basename $@).def
128endif
129	@echo AutoUnload >> $(basename $@).def
130ifeq '$(BUILD)' 'debug'
131	@echo Debug >> $(basename $@).def
132endif
133	@echo Flag_On 0x00000008 >> $(basename $@).def
134	@echo Start _LibCPrelude >> $(basename $@).def
135	@echo Exit _LibCPostlude >> $(basename $@).def
136
137	$(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc
138	@echo xdcdata $(basename $@).xdc >> $(basename $@).def
139
140	@echo Linking $@...
141	@echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link
142	@echo $(LIBRARY) $(OBJECTS) >> $(basename $@).link
143	@$(LINK) @$(basename $@).link
144
145
146.PHONY: clean
147clean: cleanobj cleanbin
148
149.PHONY: cleand
150cleand:
151	@echo Deleting all dependency files...
152	-@del "$(OBJ_DIR)\*.d"
153
154.PHONY: cleanobj
155cleanobj:
156	@echo Deleting all object files...
157	-@del "$(OBJ_DIR)\*.obj"
158
159.PHONY: cleanbin
160cleanbin:
161	@echo Deleting binary files...
162	-@del "$(FINAL_DIR)\$(MODULE_NAME).nlm"
163	@echo Deleting MAP, DEF files, etc....
164	-@del "$(FINAL_DIR)\$(MODULE_NAME).map"
165	-@del "$(FINAL_DIR)\$(MODULE_NAME).def"
166	-@del "$(FINAL_DIR)\$(MODULE_NAME).link"
167ifeq '$(BUILD)' 'debug'
168	-@del $(FINAL_DIR)\$(MODULE_NAME).sym
169endif
170