geom_gate userland utility improvements
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.
 
 
 
 

366 lines
9.5 KiB

  1. #########################################################################
  2. #
  3. ## Makefile for building libssh2 (Win32 version - gnu make)
  4. ## Use: make -f GNUmakefile [help|all|clean|dev|devclean|dist|distclean|dll|objclean]
  5. ##
  6. ## Hacked by: Guenter Knauf
  7. #
  8. #########################################################################
  9. # Edit the path below to point to the base of your Zlib sources.
  10. ifndef ZLIB_PATH
  11. ZLIB_PATH = ../../zlib-1.2.8
  12. endif
  13. # Edit the path below to point to the base of your OpenSSL package.
  14. ifndef OPENSSL_PATH
  15. OPENSSL_PATH = ../../openssl-1.0.2d
  16. endif
  17. # Edit the path below to point to your Distribution folder.
  18. ifndef DISTDIR
  19. DISTDIR = libssh2-$(LIBSSH2_VERSION_STR)-bin-$(ARCH)
  20. endif
  21. DISTARC = $(DISTDIR).zip
  22. # Edit the path below to point to your Development folder.
  23. ifndef DEVLDIR
  24. DEVLDIR = libssh2-$(LIBSSH2_VERSION_STR)-dev-$(ARCH)
  25. endif
  26. DEVLARC = $(DEVLDIR).zip
  27. # Project root
  28. PROOT = ..
  29. # Edit the vars below to change target settings.
  30. TARGET = libssh2
  31. WWWURL = https://www.libssh2.org/
  32. DESCR = libssh2 $(LIBSSH2_VERSION_STR)
  33. #STACK = 64000
  34. # must be equal to DEBUG or NDEBUG
  35. ifndef DB
  36. DB = NDEBUG
  37. # DB = DEBUG
  38. endif
  39. # Optimization: -O<n> or debugging: -g
  40. ifeq ($(DB),NDEBUG)
  41. OPT = -O2
  42. OBJDIR = release
  43. else
  44. OPT = -g
  45. OPT += -DLIBSSH2DEBUG
  46. OBJDIR = debug
  47. endif
  48. # Here you can find a native Win32 binary of the original awk:
  49. # http://www.gknw.net/development/prgtools/awk-20100523.zip
  50. AWK = awk
  51. ZIP = zip -qzr9
  52. # Platform-dependent helper tool macros
  53. ifeq ($(findstring /sh,$(SHELL)),/sh)
  54. DEL = rm -f $1
  55. RMDIR = rm -fr $1
  56. MKDIR = mkdir -p $1
  57. COPY = -cp -afv $1 $2
  58. #COPYR = -cp -afr $1/* $2
  59. COPYR = -rsync -aC $1/* $2
  60. TOUCH = touch $1
  61. CAT = cat
  62. ECHONL = echo ""
  63. DL = '
  64. else
  65. ifeq "$(OS)" "Windows_NT"
  66. DEL = -del 2>NUL /q /f $(subst /,\,$1)
  67. RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
  68. else
  69. DEL = -del 2>NUL $(subst /,\,$1)
  70. RMDIR = -deltree 2>NUL /y $(subst /,\,$1)
  71. endif
  72. MKDIR = -md 2>NUL $(subst /,\,$1)
  73. COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
  74. COPYR = -xcopy 2>NUL /q /y /e $(subst /,\,$1) $(subst /,\,$2)
  75. TOUCH = copy 2>&1>NUL /b $(subst /,\,$1) +,,
  76. CAT = type
  77. ECHONL = $(ComSpec) /c echo.
  78. endif
  79. ifeq ($(LIBSSH2_CC),)
  80. LIBSSH2_CC := $(CROSSPREFIX)gcc
  81. endif
  82. ifeq ($(LIBSSH2_AR),)
  83. LIBSSH2_AR := $(CROSSPREFIX)ar
  84. endif
  85. ifeq ($(LIBSSH2_RANLIB),)
  86. LIBSSH2_RANLIB := $(CROSSPREFIX)ranlib
  87. endif
  88. ifeq ($(LIBSSH2_DLL_A_SUFFIX),)
  89. LIBSSH2_DLL_A_SUFFIX := dll
  90. endif
  91. libssh2_dll_LIBRARY = $(TARGET)$(LIBSSH2_DLL_SUFFIX).dll
  92. # The following line defines your compiler.
  93. ifdef METROWERKS
  94. CC = mwcc
  95. else
  96. CC = $(LIBSSH2_CC)
  97. endif
  98. # Set environment var ARCH to your architecture to override autodetection.
  99. ifndef ARCH
  100. ifeq ($(findstring gcc,$(CC)),gcc)
  101. ifeq ($(findstring x86_64,$(shell $(CC) -dumpmachine)),x86_64)
  102. ARCH = w64
  103. else
  104. ARCH = w32
  105. endif
  106. else
  107. ARCH = w32
  108. endif
  109. endif
  110. # Include the version info retrieved from libssh2.h
  111. -include $(OBJDIR)/version.inc
  112. # Global flags for all compilers
  113. CFLAGS = $(LIBSSH2_CFLAG_EXTRAS) $(OPT) -D$(DB) -DLIBSSH2_WIN32 -DHAVE_WINDOWS_H # -DHAVE_CONFIG_H
  114. LDFLAGS = $(LIBSSH2_LDFLAG_EXTRAS)
  115. ifeq ($(CC),mwcc)
  116. LD = mwld
  117. RC = mwwinrc
  118. LDFLAGS += -nostdlib
  119. AR = $(LD)
  120. ARFLAGS = -nostdlib -library -o
  121. LIBEXT = lib
  122. #RANLIB =
  123. LIBPATH += -lr "$(METROWERKS)/MSL" -lr "$(METROWERKS)/Win32-x86 Support"
  124. LDLIBS += -lMSL_Runtime_x86.lib -lMSL_C_x86.lib -lMSL_Extras_x86.lib
  125. RCFLAGS =
  126. CFLAGS += -nostdinc -gccinc -msgstyle gcc -inline off -opt nointrinsics -proc 586
  127. CFLAGS += -ir "$(METROWERKS)/MSL" -ir "$(METROWERKS)/Win32-x86 Support"
  128. CFLAGS += -w on,nounused,nounusedexpr # -ansi strict
  129. else
  130. LIBEXT = a
  131. LD = $(LIBSSH2_CC)
  132. RC = $(CROSSPREFIX)windres
  133. LDFLAGS += -s -shared -Wl,--output-def,$(libssh2_dll_LIBRARY:.dll=.def),--out-implib,$(TARGET)$(LIBSSH2_DLL_A_SUFFIX).$(LIBEXT)
  134. AR = $(LIBSSH2_AR)
  135. ARFLAGS = cru
  136. RANLIB = $(LIBSSH2_RANLIB)
  137. RCFLAGS = -I $(PROOT)/include -O coff
  138. CFLAGS += -fno-builtin
  139. CFLAGS += -fno-strict-aliasing
  140. CFLAGS += -Wall # -pedantic
  141. ifeq ($(ARCH),w64)
  142. CFLAGS += -m64 -D_AMD64_
  143. LDFLAGS += -m64
  144. RCFLAGS += -F pe-x86-64
  145. else
  146. CFLAGS += -m32
  147. LDFLAGS += -m32
  148. RCFLAGS += -F pe-i386
  149. endif
  150. endif
  151. INCLUDES = -I$(PROOT)/win32 -I$(PROOT)/include
  152. ifdef WITH_WINCNG
  153. CFLAGS += -DLIBSSH2_WINCNG
  154. LDLIBS += -lbcrypt -lcrypt32
  155. else
  156. CFLAGS += -DLIBSSH2_OPENSSL
  157. ifndef OPENSSL_INCLUDE
  158. ifeq "$(wildcard $(OPENSSL_PATH)/outinc)" "$(OPENSSL_PATH)/outinc"
  159. OPENSSL_INCLUDE = $(OPENSSL_PATH)/outinc
  160. endif
  161. ifeq "$(wildcard $(OPENSSL_PATH)/include)" "$(OPENSSL_PATH)/include"
  162. OPENSSL_INCLUDE = $(OPENSSL_PATH)/include
  163. endif
  164. endif
  165. ifneq "$(wildcard $(OPENSSL_INCLUDE)/openssl/opensslv.h)" "$(OPENSSL_INCLUDE)/openssl/opensslv.h"
  166. $(error Invalid OPENSSL_PATH: $(OPENSSL_PATH))
  167. endif
  168. INCLUDES += -I"$(OPENSSL_INCLUDE)"
  169. ifndef OPENSSL_LIBPATH
  170. OPENSSL_LIBS_STAT = crypto ssl
  171. ifeq "$(wildcard $(OPENSSL_PATH)/out)" "$(OPENSSL_PATH)/out"
  172. OPENSSL_LIBPATH = $(OPENSSL_PATH)/out
  173. OPENSSL_LIBS_DYN = eay32 ssl32
  174. endif
  175. ifeq "$(wildcard $(OPENSSL_PATH)/lib)" "$(OPENSSL_PATH)/lib"
  176. OPENSSL_LIBPATH = $(OPENSSL_PATH)/lib
  177. OPENSSL_LIBS_DYN = crypto.dll ssl.dll
  178. endif
  179. endif
  180. ifdef LINK_OPENSSL_STATIC
  181. LDLIBS += $(patsubst %,$(OPENSSL_LIBPATH)/lib%.$(LIBEXT), $(OPENSSL_LIBS_STAT)) -lgdi32
  182. else
  183. LDLIBS += $(patsubst %,$(OPENSSL_LIBPATH)/lib%.$(LIBEXT), $(OPENSSL_LIBS_DYN))
  184. endif
  185. endif
  186. ifeq ($(CC),mwcc)
  187. LDLIBS += -lkernel32.lib -luser32.lib -lwsock32.lib
  188. else
  189. #LDLIBS += -lwsock32
  190. LDLIBS += -lws2_32
  191. endif
  192. ifdef WITH_ZLIB
  193. CFLAGS += -DLIBSSH2_HAVE_ZLIB
  194. INCLUDES += -I$(ZLIB_PATH)
  195. ifdef LINK_ZLIB_STATIC
  196. LDLIBS += $(ZLIB_PATH)/libz.$(LIBEXT)
  197. else
  198. LDLIBS += $(ZLIB_PATH)/libz.dll.$(LIBEXT)
  199. endif
  200. endif
  201. CFLAGS += $(INCLUDES)
  202. vpath %.c $(PROOT)/src
  203. ifdef WITH_WINCNG
  204. include $(PROOT)/Makefile.WinCNG.inc
  205. else
  206. include $(PROOT)/Makefile.OpenSSL.inc
  207. endif
  208. # include Makefile.inc to get CSOURCES define
  209. include $(PROOT)/Makefile.inc
  210. OBJECTS := $(patsubst %.c,%.o,$(CSOURCES))
  211. OBJS := $(addprefix $(OBJDIR)/,$(OBJECTS))
  212. OBJL = $(OBJS) $(OBJDIR)/$(TARGET).res
  213. all: lib dll
  214. dll: prebuild $(libssh2_dll_LIBRARY)
  215. lib: prebuild $(TARGET).$(LIBEXT)
  216. prebuild: $(OBJDIR) $(OBJDIR)/version.inc
  217. # libssh2_config.h
  218. test: all
  219. $(MAKE) -C test -f GNUmakefile
  220. $(OBJDIR)/%.o: %.c
  221. # @echo Compiling $<
  222. $(CC) $(CFLAGS) -c $< -o $@
  223. $(OBJDIR)/version.inc: $(PROOT)/get_ver.awk $(PROOT)/include/libssh2.h $(OBJDIR)
  224. @echo Creating $@
  225. @$(AWK) -f $^ > $@
  226. dist: all $(DISTDIR) $(DISTDIR)/readme.txt
  227. @$(call MKDIR, $(DISTDIR)/bin)
  228. @$(call COPY, $(PROOT)/AUTHORS, $(DISTDIR))
  229. @$(call COPY, $(PROOT)/COPYING, $(DISTDIR))
  230. @$(call COPY, $(PROOT)/INSTALL, $(DISTDIR))
  231. @$(call COPY, $(PROOT)/README, $(DISTDIR))
  232. @$(call COPY, $(PROOT)/RELEASE-NOTES, $(DISTDIR))
  233. @$(call COPY, $(libssh2_dll_LIBRARY), $(DISTDIR)/bin)
  234. @echo Creating $(DISTARC)
  235. @$(ZIP) $(DISTARC) $(DISTDIR)/* < $(DISTDIR)/readme.txt
  236. dev: all $(DEVLDIR) $(DEVLDIR)/readme.txt
  237. @$(call MKDIR, $(DEVLDIR)/bin)
  238. @$(call MKDIR, $(DEVLDIR)/include)
  239. @$(call MKDIR, $(DEVLDIR)/win32)
  240. @$(call COPY, $(PROOT)/AUTHORS, $(DEVLDIR))
  241. @$(call COPY, $(PROOT)/COPYING, $(DEVLDIR))
  242. @$(call COPY, $(PROOT)/INSTALL, $(DEVLDIR))
  243. @$(call COPY, $(PROOT)/README, $(DEVLDIR))
  244. @$(call COPY, $(PROOT)/RELEASE-NOTES, $(DEVLDIR))
  245. @$(call COPY, $(libssh2_dll_LIBRARY), $(DEVLDIR)/bin)
  246. @$(call COPY, $(PROOT)/include/*.h, $(DEVLDIR)/include)
  247. @$(call COPY, libssh2_config.h, $(DEVLDIR)/include)
  248. @$(call COPY, *.$(LIBEXT), $(DEVLDIR)/win32)
  249. @echo Creating $(DEVLARC)
  250. @$(ZIP) $(DEVLARC) $(DEVLDIR)/* < $(DEVLDIR)/readme.txt
  251. distclean vclean: clean
  252. $(call RMDIR, $(DISTDIR))
  253. $(call DEL, $(DISTARC))
  254. devclean: clean
  255. $(call RMDIR, $(DEVLDIR))
  256. $(call DEL, $(DEVLARC))
  257. objclean: all
  258. $(call RMDIR, $(OBJDIR))
  259. testclean: clean
  260. $(MAKE) -C test -f GNUmakefile clean
  261. clean:
  262. # $(call DEL, libssh2_config.h)
  263. $(call DEL, $(libssh2_dll_LIBRARY) $(libssh2_dll_LIBRARY:.dll=.def) $(TARGET).$(LIBEXT) $(TARGET)$(LIBSSH2_DLL_A_SUFFIX).$(LIBEXT))
  264. $(call RMDIR, $(OBJDIR))
  265. $(OBJDIR):
  266. @$(call MKDIR, $@)
  267. $(DISTDIR):
  268. @$(call MKDIR, $@)
  269. $(DEVLDIR):
  270. @$(call MKDIR, $@)
  271. $(TARGET).$(LIBEXT): $(OBJS)
  272. @echo Creating $@
  273. @$(call DEL, $@)
  274. @$(AR) $(ARFLAGS) $@ $^
  275. ifdef RANLIB
  276. @$(RANLIB) $@
  277. endif
  278. $(libssh2_dll_LIBRARY) $(TARGET)$(LIBSSH2_DLL_A_SUFFIX).$(LIBEXT): $(OBJL)
  279. @echo Linking $@
  280. @$(call DEL, $@)
  281. @$(LD) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LDLIBS)
  282. $(OBJDIR)/%.res: %.rc
  283. @echo Creating $@
  284. @$(RC) $(RCFLAGS) -i $< -o $@
  285. $(DISTDIR)/readme.txt: GNUmakefile
  286. @echo Creating $@
  287. @echo $(DL)This is a binary distribution for Win32 platform.$(DL) > $@
  288. @echo $(DL)libssh version $(LIBSSH2_VERSION_STR)$(DL) >> $@
  289. @echo $(DL)Please download the complete libssh package for$(DL) >> $@
  290. @echo $(DL)any further documentation:$(DL) >> $@
  291. @echo $(DL)$(WWWURL)$(DL) >> $@
  292. $(DEVLDIR)/readme.txt: GNUmakefile
  293. @echo Creating $@
  294. @echo $(DL)This is a development distribution for Win32 platform.$(DL) > $@
  295. @echo $(DL)libssh version $(LIBSSH2_VERSION_STR)$(DL) >> $@
  296. @echo $(DL)Please download the complete libssh package for$(DL) >> $@
  297. @echo $(DL)any further documentation:$(DL) >> $@
  298. @echo $(DL)$(WWWURL)$(DL) >> $@
  299. help: $(OBJDIR)/version.inc
  300. @echo $(DL)===========================================================$(DL)
  301. @echo $(DL)OpenSSL path = $(OPENSSL_PATH)$(DL)
  302. @echo $(DL)Zlib path = $(ZLIB_PATH)$(DL)
  303. @echo $(DL)===========================================================$(DL)
  304. @echo $(DL)libssh $(LIBSSH2_VERSION_STR) - available targets are:$(DL)
  305. @echo $(DL)$(MAKE) all$(DL)
  306. @echo $(DL)$(MAKE) dll$(DL)
  307. @echo $(DL)$(MAKE) lib$(DL)
  308. @echo $(DL)$(MAKE) clean$(DL)
  309. @echo $(DL)$(MAKE) dev$(DL)
  310. @echo $(DL)$(MAKE) devclean$(DL)
  311. @echo $(DL)$(MAKE) dist$(DL)
  312. @echo $(DL)$(MAKE) distclean$(DL)
  313. @echo $(DL)$(MAKE) objclean$(DL)
  314. @echo $(DL)$(MAKE) test$(DL)
  315. @echo $(DL)===========================================================$(DL)