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