You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161 lines
4.2 KiB

  1. # Temporarily here -- later may go into some batch file
  2. # which will set this as an environment variable
  3. PROJECT_ROOT = ../..
  4. # Module details
  5. MODULE_NAME = mod_php
  6. MODULE_DESC = "PHP 4.x.x for NetWare - mod_php"
  7. VMAJ = 0
  8. VMIN = 90
  9. VREV = 0
  10. #include the common settings
  11. include $(PROJECT_ROOT)/netware/common.mif
  12. # Extensions of all input and output files
  13. .SUFFIXES:
  14. .SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
  15. # Source files
  16. C_SRC = mod_php4.c \
  17. php_apache.c \
  18. sapi_apache.c
  19. # Destination directories and files
  20. OBJ_DIR = $(BUILD)
  21. FINAL_DIR = $(BUILD)
  22. MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map
  23. OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.obj) $(C_SRC:.c=.obj))
  24. DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.d) $(C_SRC:.c=.d))
  25. # Binary file
  26. ifndef BINARY
  27. BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm
  28. endif
  29. # Compile flags
  30. C_FLAGS = -c -maxerrors 25 -msgstyle gcc
  31. C_FLAGS += -wchar_t on -bool on
  32. C_FLAGS += -processor Pentium -align 1
  33. C_FLAGS += -w nounusedarg -msext on
  34. C_FLAGS += -nostdinc
  35. C_FLAGS += -DNETWARE -D__GNUC__
  36. C_FLAGS += -DZTS
  37. C_FLAGS += -DNLM_PLATFORM
  38. C_FLAGS += -DN_PLAT_NLM -DNLM=1 -D__NO_MATH_OPS
  39. C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED -DAPACHE_OS_H -DNO_USE_SIGACTION -DMULTITHREAD
  40. C_FLAGS += -DCLIB_STAT_PATCH
  41. C_FLAGS += -DNEW_LIBC
  42. #C_FLAGS += -DUSE_WINSOCK_DIRECTLY=1
  43. C_FLAGS += -I. -I- -I. -I../../netware -I$(SDK_DIR)/include # ../../netware added for special SYS/STAT.H
  44. C_FLAGS += -I$(MWCIncludes)
  45. C_FLAGS += -I$(APACHE_DIR)/include -I$(APACHE_DIR)/os/netware
  46. C_FLAGS += -I- -I../../main -I../../Zend -I../../TSRM -I../../ext/standard
  47. C_FLAGS += -I../../ -I../../netware -I$(PROJECT_ROOT)/regex
  48. C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include
  49. # Extra stuff based on debug / release builds
  50. ifeq '$(BUILD)' 'debug'
  51. SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym
  52. C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -sym internal -DDEBUGGING -DDKFBPON
  53. C_FLAGS += -r -DZEND_DEBUG
  54. C_FLAGS += -exc cw
  55. LD_FLAGS += -sym on -sym codeview4 -sym internal -osym $(SYM_FILE)
  56. LD_FLAGS += -msgstyle std
  57. export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
  58. else
  59. C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off -DZEND_DEBUG=0
  60. C_FLAGS += -opt intrinsics
  61. C_FLAGS += -opt level=4
  62. LD_FLAGS += -sym off
  63. export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
  64. endif
  65. # Dependencies
  66. MODULE = LibC \
  67. phplib
  68. IMPORT = @$(SDK_DIR)/imports/libc.imp \
  69. @$(APACHE_DIR)/os/netware/apachecore.imp \
  70. @$(PROJECT_ROOT)/netware/phplib.imp
  71. EXPORT = php4_module
  72. # Virtual paths
  73. vpath %.cpp .
  74. vpath %.c .
  75. vpath %.obj $(OBJ_DIR)
  76. all: prebuild project
  77. .PHONY: all
  78. prebuild:
  79. @if not exist $(OBJ_DIR) md $(OBJ_DIR)
  80. project: $(BINARY) $(MESSAGE)
  81. @echo Build complete.
  82. $(OBJ_DIR)/%.d: %.c
  83. @echo Building Dependencies for $(<F)
  84. @$(CC) -M $< $(C_FLAGS) -o $@
  85. $(OBJ_DIR)/%.obj: %.c
  86. @echo Compiling $?...
  87. @$(CC) $< $(C_FLAGS) -o $@
  88. $(BINARY): $(DEPDS) $(OBJECTS)
  89. @echo Import $(IMPORT) > $(basename $@).def
  90. ifdef API
  91. @echo Import $(API) >> $(basename $@).def
  92. endif
  93. @echo Module $(MODULE) >> $(basename $@).def
  94. ifdef EXPORT
  95. @echo Export $(EXPORT) >> $(basename $@).def
  96. endif
  97. @echo AutoUnload >> $(basename $@).def
  98. ifeq '$(BUILD)' 'debug'
  99. @echo Debug >> $(basename $@).def
  100. endif
  101. @echo Flag_On 0x00000008 >> $(basename $@).def
  102. @echo Start _lib_start >> $(basename $@).def
  103. @echo Exit _lib_stop >> $(basename $@).def
  104. @echo Linking $@...
  105. @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link
  106. ifdef LIBRARY
  107. @echo $(LIBRARY) >> $(basename $@).link
  108. endif
  109. @echo $(OBJECTS) $(APACHE_DIR)/os/netware/libpre.obj >> $(basename $@).link
  110. @$(LINK) @$(basename $@).link
  111. .PHONY: clean
  112. clean: cleand cleanobj cleanbin
  113. .PHONY: cleand
  114. cleand:
  115. @echo Deleting all dependency files...
  116. -@del "$(OBJ_DIR)\*.d"
  117. .PHONY: cleanobj
  118. cleanobj:
  119. @echo Deleting all object files...
  120. -@del "$(OBJ_DIR)\*.obj"
  121. .PHONY: cleanbin
  122. cleanbin:
  123. @echo Deleting binary files...
  124. -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm"
  125. @echo Deleting MAP, DEF files, etc....
  126. -@del "$(FINAL_DIR)\$(MODULE_NAME).map"
  127. -@del "$(FINAL_DIR)\$(MODULE_NAME).def"
  128. -@del "$(FINAL_DIR)\$(MODULE_NAME).link"
  129. ifeq '$(BUILD)' 'debug'
  130. -@del $(FINAL_DIR)\$(MODULE_NAME).sym
  131. endif