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