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