xref: /PHP-7.0/ext/xml/xml.mak (revision cf0303e7)
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_xml
7MODULE_DESC = "PHP 7 - XML 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 = xml.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_XML -DHAVE_LIBEXPAT=1
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$(EXPAT_DIR)/include
56
57ifndef STACK_SIZE
58STACK_SIZE=8192
59endif
60
61# Extra stuff based on debug / release builds
62ifeq '$(BUILD)' 'debug'
63	SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym
64	C_FLAGS  += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -sym internal -DDEBUGGING -DDKFBPON
65	C_FLAGS += -exc cw -DZEND_DEBUG=1
66	LD_FLAGS += -sym on -sym codeview4 -osym $(SYM_FILE)
67	export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
68else
69	C_FLAGS  += -opt speed -inline on -inline smart -inline auto -sym off
70	C_FLAGS += -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# Dependencies
77MODULE = LibC     \
78         expatlbc \
79         phplib
80IMPORT = @$(SDK_DIR)/imports/libc.imp        \
81         @$(SDK_DIR)/imports/ws2nlm.imp      \
82         @$(MPK_DIR)/import/mpkOrg.imp       \
83         @$(EXPAT_DIR)/imports/expatlbc.imp             \
84         @$(PROJECT_ROOT)/netware/phplib.imp
85EXPORT = ($(MODULE_NAME)) get_module
86API =  OutputToScreen
87
88
89# Virtual paths
90vpath %.cpp .
91vpath %.c . ..\..\netware
92vpath %.obj $(OBJ_DIR)
93
94
95all: prebuild project
96
97.PHONY: all
98
99prebuild:
100	@if not exist $(OBJ_DIR) md $(OBJ_DIR)
101
102project: $(BINARY)
103	@echo Build complete.
104
105$(OBJ_DIR)/%.d: %.cpp
106	@echo Building Dependencies for $(<F)
107	@$(CC) -M $< $(C_FLAGS) -o $@
108
109$(OBJ_DIR)/%.d: %.c
110	@echo Building Dependencies for $(<F)
111	@$(CC) -M $< $(C_FLAGS) -o $@
112
113$(OBJ_DIR)/%.obj: %.cpp
114	@echo Compiling $?...
115	@$(CC) $< $(C_FLAGS) -o $@
116
117$(OBJ_DIR)/%.obj: %.c
118	@echo Compiling $?...
119	@$(CC) $< $(C_FLAGS) -o $@
120
121
122$(BINARY): $(OBJECTS)
123	@echo Import $(IMPORT) > $(basename $@).def
124ifdef API
125	@echo Import $(API) >> $(basename $@).def
126endif
127	@echo Module $(MODULE) >> $(basename $@).def
128ifdef EXPORT
129	@echo Export $(EXPORT) >> $(basename $@).def
130endif
131	@echo AutoUnload >> $(basename $@).def
132ifeq '$(BUILD)' 'debug'
133	@echo Debug >> $(basename $@).def
134endif
135	@echo Flag_On 0x00000008 >> $(basename $@).def
136	@echo Start _LibCPrelude >> $(basename $@).def
137	@echo Exit _LibCPostlude >> $(basename $@).def
138
139	$(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc
140	@echo xdcdata $(basename $@).xdc >> $(basename $@).def
141
142	@echo Linking $@...
143	@echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link
144	@echo $(LIBRARY) $(OBJECTS) >> $(basename $@).link
145
146	@$(LINK) @$(basename $@).link
147
148
149.PHONY: clean
150clean: cleanobj cleanbin
151
152.PHONY: cleand
153cleand:
154	@echo Deleting all dependency files...
155	-@del "$(OBJ_DIR)\*.d"
156
157.PHONY: cleanobj
158cleanobj:
159	@echo Deleting all object files...
160	-@del "$(OBJ_DIR)\*.obj"
161
162.PHONY: cleanbin
163cleanbin:
164	@echo Deleting binary files...
165	-@del "$(FINAL_DIR)\$(MODULE_NAME).nlm"
166	@echo Deleting MAP, DEF files, etc....
167	-@del "$(FINAL_DIR)\$(MODULE_NAME).map"
168	-@del "$(FINAL_DIR)\$(MODULE_NAME).def"
169	-@del "$(FINAL_DIR)\$(MODULE_NAME).link"
170ifeq '$(BUILD)' 'debug'
171	-@del $(FINAL_DIR)\$(MODULE_NAME).sym
172endif
173