Makefile.win 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. # -*- Makefile -*-
  2. !IF "$(OS)" == "Windows_NT"
  3. NULL=
  4. rmdir=rd /s /q
  5. !ELSE
  6. NULL=nul
  7. rmdir=deltree /y
  8. !ENDIF
  9. SILENT=@
  10. # Default build and bind modes
  11. BUILD_MODE = release
  12. BIND_MODE = shared
  13. !IF "$(BUILD_MODE)" == "release" || "$(BUILD_MODE)" == "Release"
  14. !IF "$(BIND_MODE)" == "shared"
  15. # release shared
  16. APR_LIB_PFX = $(APR_SOURCE)\Release\lib
  17. APU_LIB_PFX = $(APU_SOURCE)\Release\lib
  18. API_LIB_PFX = $(API_SOURCE)\Release\lib
  19. CFG_CFLAGS = /MD /O2
  20. CFG_DEFINES = /D "NDEBUG"
  21. CFG_OUTPUT = Release
  22. !ELSE
  23. !IF "$(BIND_MODE)" == "static"
  24. # release static
  25. APR_LIB_PFX = $(APR_SOURCE)\LibR\ # no line continuation
  26. APU_LIB_PFX = $(APU_SOURCE)\LibR\ # no line continuation
  27. API_LIB_PFX = $(API_SOURCE)\LibR\ # no line continuation
  28. CFG_CFLAGS = /MD /O2
  29. CFG_DEFINES = /D "NDEBUG" /D "APR_DECLARE_STATIC" \
  30. /D "APU_DECLARE_STATIC" /D "API_DECLARE_STATIC"
  31. CFG_API_LIB = $(API_LIB_PFX)apriconv-1.lib
  32. CFG_OUTPUT = LibR
  33. !ELSE
  34. !ERROR Unknown bind mode "$(BIND_MODE)"
  35. !ENDIF
  36. !ENDIF
  37. !ELSE
  38. !IF "$(BUILD_MODE)" == "debug" || "$(BUILD_MODE)" == "Debug"
  39. !IF "$(BIND_MODE)" == "shared"
  40. # debug shared
  41. APR_LIB_PFX = $(APR_SOURCE)\Debug\lib
  42. APU_LIB_PFX = $(APU_SOURCE)\Debug\lib
  43. API_LIB_PFX = $(API_SOURCE)\Debug\lib
  44. CFG_CFLAGS = /MDd /Zi /Od
  45. CFG_DEFINES = /D "_DEBUG"
  46. CFG_LDFLAGS = /DEBUG
  47. CFG_OUTPUT = Debug
  48. !ELSE
  49. !IF "$(BIND_MODE)" == "static"
  50. # debug static
  51. APR_LIB_PFX = $(APR_SOURCE)\LibD\ # no line continuation
  52. APU_LIB_PFX = $(APU_SOURCE)\LibD\ # no line continuation
  53. API_LIB_PFX = $(API_SOURCE)\LibD\ # no line continuation
  54. CFG_CFLAGS = /MDd /Zi /Od
  55. CFG_DEFINES = /D "_DEBUG" /D "APR_DECLARE_STATIC" \
  56. /D "APU_DECLARE_STATIC" /D "API_DECLARE_STATIC"
  57. CFG_LDFLAGS = /DEBUG
  58. CFG_API_LIB = $(API_LIB_PFX)apriconv-1.lib
  59. CFG_OUTPUT = LibD
  60. !ELSE
  61. !ERROR Unknown bind mode "$(BIND_MODE)"
  62. !ENDIF
  63. !ENDIF
  64. !ELSE
  65. !ERROR Unknown build mode "$(BUILD_MODE)"
  66. !ENDIF
  67. !ENDIF
  68. APR_SOURCE = ..\..\apr
  69. APU_SOURCE = ..
  70. API_SOURCE = ..\..\apr-iconv
  71. OUTPUT_DIR = .\$(CFG_OUTPUT)
  72. INT_CFLAGS = /nologo $(CFG_CFLAGS) /Fp"$(OUTPUT_DIR)\iconv.pch" /YX"iconv.h"
  73. INT_INCLUDES = /I "$(APU_SOURCE)\include" /I "$(APR_SOURCE)\include"
  74. # /I "$(API_SOURCE)\include"
  75. INT_DEFINES = /D "WIN32" /D "_CONSOLE" /D "_MBCS" $(CFG_DEFINES)
  76. INT_LDFLAGS = /nologo /incremental:no /subsystem:console $(CFG_LDFLAGS)
  77. CFLAGS = /W3
  78. ALL_CFLAGS = $(INT_CFLAGS) $(INT_INCLUDES) $(INT_DEFINES) $(CFLAGS)
  79. LDFLAGS = /WARN:0
  80. ALL_LDFLAGS = $(INT_LDFLAGS) $(LDFLAGS)
  81. .c{$(OUTPUT_DIR)}.exe:
  82. -$(SILENT)if not exist "$(OUTPUT_DIR)\$(NULL)" mkdir "$(OUTPUT_DIR)"
  83. $(SILENT)echo Compiling and linking $@...
  84. $(SILENT)cl $(ALL_CFLAGS) /Fo"$*.obj" /Fd"$*" $< \
  85. /link $(ALL_LDFLAGS) /out:$@ \
  86. "$(APU_LIB_PFX)aprutil-1.lib" \
  87. "$(APR_LIB_PFX)apr-1.lib" \
  88. "$(CFG_API)" \
  89. kernel32.lib advapi32.lib ws2_32.lib mswsock.lib
  90. ##!ALL_TARGETS = $(OUTPUT_DIR)\testdate.exe \
  91. ##! $(OUTPUT_DIR)\testdbm.exe \
  92. ##! $(OUTPUT_DIR)\testmd4.exe \
  93. ##! $(OUTPUT_DIR)\testmd5.exe \
  94. ##! $(OUTPUT_DIR)\testqueue.exe \
  95. ##! $(OUTPUT_DIR)\testreslist.exe \
  96. ##! $(OUTPUT_DIR)\testrmm.exe \
  97. ##! $(OUTPUT_DIR)\teststrmatch.exe \
  98. ##! $(OUTPUT_DIR)\testuri.exe \
  99. ##! $(OUTPUT_DIR)\testuuid.exe \
  100. ##! $(OUTPUT_DIR)\testxlate.exe \
  101. ##! $(OUTPUT_DIR)\testxml.exe
  102. ALL_TARGETS = $(OUTPUT_DIR)\testxlate.exe \
  103. $(OUTPUT_DIR)\testdbm.exe \
  104. $(OUTPUT_DIR)\testqueue.exe \
  105. $(OUTPUT_DIR)\testrmm.exe \
  106. $(OUTPUT_DIR)\testmd4.exe \
  107. $(OUTPUT_DIR)\testmd5.exe \
  108. $(OUTPUT_DIR)\testxml.exe
  109. all: $(ALL_TARGETS)
  110. clean:
  111. -$(SILENT)if exist "$(OUTPUT_DIR)/$(NULL)" $(rmdir) $(OUTPUT_DIR)