File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / mysql / mysql.mak
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:58 2012 UTC (12 years, 8 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    1: # Temporarily here -- later may go into some batch file
    2: # which will set this as an environment variable
    3: PROJECT_ROOT = ..\..
    4: 
    5: # Module details
    6: MODULE_NAME = phpmysql
    7: MODULE_DESC = "PHP 4.3 - MySQL Extension"
    8: VMAJ = 3
    9: VMIN = 0
   10: VREV = 0
   11: 
   12: #include the common settings
   13: include $(PROJECT_ROOT)/netware/common.mif
   14: 
   15: # MYSQL stuff
   16: MYSQL_DIR = P:/APPS/script/sw/mysql
   17: 
   18: # Build type defaults to 'release'
   19: ifndef BUILD
   20: BUILD = release
   21: endif
   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
   28: C_SRC = php_mysql.c \
   29:         start.c 
   30: 
   31: CPP_SRC_NODIR = $(notdir $(CPP_SRC))
   32: C_SRC_NODIR = $(notdir $(C_SRC))
   33: SRC_DIR = $(dir $(CPP_SRC) $(C_SRC))
   34: 
   35: # Library files
   36: LIBRARY = $(MYSQL_DIR)/lib/libmysqlclient.lib
   37: 
   38: # Destination directories and files
   39: OBJ_DIR = $(BUILD)
   40: FINAL_DIR = $(BUILD)
   41: OBJECTS  = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj))
   42: DEPDS  = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d))
   43: 
   44: # Binary file
   45: ifndef BINARY
   46: 	BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm
   47: endif
   48: 
   49: # Compile flags
   50: C_FLAGS  = -c -maxerrors 25 -msgstyle gcc -wchar_t on -bool on -processor Pentium
   51: C_FLAGS += -nostdinc -nosyspath  
   52: C_FLAGS += -relax_pointers		# To remove type-casting errors
   53: C_FLAGS += -DNETWARE -DZTS -DNEW_LIBC -DUSE_OLD_FUNCTIONS -DCOMPILE_DL_MYSQL=1
   54: C_FLAGS += -I. -I- -I$(PROJECT_ROOT) -I$(PROJECT_ROOT)/main
   55: C_FLAGS += -I$(PROJECT_ROOT)/ext/standard -I$(PROJECT_ROOT)/netware
   56: C_FLAGS += -I$(PROJECT_ROOT)/zend -I$(PROJECT_ROOT)/tsrm
   57: C_FLAGS += -I$(SDK_DIR)/include -I$(MWCIncludes)
   58: C_FLAGS += -I$(MYSQL_DIR)/include
   59: C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include
   60: 
   61: 
   62: # Extra stuff based on debug / release builds
   63: ifeq '$(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
   69: else
   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
   74: endif
   75: 
   76: 
   77: # Dependencies
   78: MODULE = LibC    \
   79:          phplib
   80: IMPORT = @$(SDK_DIR)/imports/libc.imp        \
   81:          @$(SDK_DIR)/imports/ws2nlm.imp      \
   82:          @$(MPK_DIR)/import/mpkOrg.imp       \
   83:          @$(PROJECT_ROOT)/netware/phplib.imp
   84: EXPORT = ($(MODULE_NAME)) get_module
   85: API = OutputToScreen
   86: 
   87: # Virtual paths
   88: vpath %.cpp .
   89: vpath %.c . ..\..\netware
   90: vpath %.obj $(OBJ_DIR)
   91: 
   92: 
   93: all: prebuild project
   94: 
   95: .PHONY: all
   96: 
   97: prebuild:
   98: 	@if not exist $(OBJ_DIR) md $(OBJ_DIR)
   99: 
  100: project: $(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
  122: ifdef API
  123: 	@echo Import $(API) >> $(basename $@).def
  124: endif
  125: 	@echo Module $(MODULE) >> $(basename $@).def
  126: ifdef EXPORT
  127: 	@echo Export $(EXPORT) >> $(basename $@).def
  128: endif
  129: 	@echo AutoUnload >> $(basename $@).def
  130: ifeq '$(BUILD)' 'debug'
  131: 	@echo Debug >> $(basename $@).def
  132: endif
  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
  147: clean: cleanobj cleanbin
  148: 
  149: .PHONY: cleand
  150: cleand:
  151: 	@echo Deleting all dependency files...
  152: 	-@del "$(OBJ_DIR)\*.d"
  153: 
  154: .PHONY: cleanobj
  155: cleanobj:
  156: 	@echo Deleting all object files...
  157: 	-@del "$(OBJ_DIR)\*.obj"
  158: 
  159: .PHONY: cleanbin
  160: cleanbin:
  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"
  167: ifeq '$(BUILD)' 'debug'
  168: 	-@del $(FINAL_DIR)\$(MODULE_NAME).sym
  169: endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>