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.
 
 
 
 

312 lines
8.0 KiB

  1. #########################################################################
  2. #
  3. ## Makefile for building libssh2 (NetWare version - gnu make)
  4. ##
  5. ## Hacked by: Guenter Knauf
  6. #
  7. #########################################################################
  8. # Edit the path below to point to the base of your Novell NDK.
  9. ifndef NDKBASE
  10. NDKBASE = c:/novell
  11. endif
  12. # Edit the path below to point to the base of your Zlib sources.
  13. ifndef ZLIB_PATH
  14. ZLIB_PATH = ../../../zlib-1.2.8
  15. endif
  16. # Edit the path below to point to the base of your OpenSSL package.
  17. ifndef OPENSSL_PATH
  18. OPENSSL_PATH = ../../../openssl-0.9.8zc
  19. endif
  20. # Edit the var below to enable static linking of libssh2 and libz
  21. LINK_STATIC = 1
  22. # Edit the vars below to change NLM target settings.
  23. SAMPLES = ../../example
  24. TARGETS := $(filter-out x11.nlm,$(patsubst $(SAMPLES)/%.c,%.nlm,$(strip $(wildcard $(SAMPLES)/*.c))))
  25. VERSION = $(LIBSSH2_VERSION)
  26. COPYR = Copyright (c) $(LIBSSH2_COPYRIGHT_STR)
  27. WWWURL = http://www.libssh2.org/
  28. DESCR = libssh2 $(notdir $(@:.def=)) $(LIBSSH2_VERSION_STR) ($(LIBARCH)) - $(WWWURL)
  29. MTSAFE = YES
  30. STACK = 64000
  31. SCREEN = NONE
  32. #SCREEN = libssh2 $(notdir $(@:.def=))
  33. # Comment the line below if you dont want to load protected automatically.
  34. #LDRING = 3
  35. # Edit the var below to point to your lib architecture.
  36. ifndef LIBARCH
  37. LIBARCH = LIBC
  38. endif
  39. # must be equal to DEBUG or NDEBUG
  40. ifndef DB
  41. DB = NDEBUG
  42. # DB = DEBUG
  43. endif
  44. # Optimization: -O<n> or debugging: -g
  45. ifeq ($(DB),NDEBUG)
  46. OPT = -O2
  47. OBJDIR = release
  48. else
  49. OPT = -g
  50. OPT += -DLIBSSH2DEBUG
  51. OBJDIR = debug
  52. endif
  53. # The following lines defines your compiler.
  54. ifdef CWFolder
  55. METROWERKS = $(CWFolder)
  56. endif
  57. ifdef METROWERKS
  58. # MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
  59. MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
  60. CC = mwccnlm
  61. else
  62. CC = $(CROSSPREFIX)gcc
  63. endif
  64. # Here you can find a native Win32 binary of the original awk:
  65. # http://www.gknw.net/development/prgtools/awk-20100523.zip
  66. AWK = awk
  67. # If you want to mark the target as MTSAFE you will need a tool for
  68. # generating the xdc data for the linker; here's a minimal tool:
  69. # http://www.gknw.net/development/prgtools/mkxdc.zip
  70. MPKXDC = mkxdc
  71. # Platform-dependent helper tool macros
  72. ifeq ($(findstring /sh,$(SHELL)),/sh)
  73. DEL = rm -f $1
  74. RMDIR = rm -fr $1
  75. MKDIR = mkdir -p $1
  76. COPY = -cp -afv $1 $2
  77. #COPYR = -cp -afr $1/* $2
  78. COPYR = -rsync -aC $1/* $2
  79. TOUCH = touch $1
  80. CAT = cat
  81. ECHONL = echo ""
  82. DL = '
  83. else
  84. ifeq "$(OS)" "Windows_NT"
  85. DEL = -del 2>NUL /q /f $(subst /,\,$1)
  86. RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
  87. else
  88. DEL = -del 2>NUL $(subst /,\,$1)
  89. RMDIR = -deltree 2>NUL /y $(subst /,\,$1)
  90. endif
  91. MKDIR = -md 2>NUL $(subst /,\,$1)
  92. COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
  93. COPYR = -xcopy 2>NUL /q /y /e $(subst /,\,$1) $(subst /,\,$2)
  94. TOUCH = copy 2>&1>NUL /b $(subst /,\,$1) +,,
  95. CAT = type
  96. ECHONL = $(ComSpec) /c echo.
  97. endif
  98. # LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH))
  99. LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH))
  100. # Include the version info retrieved from libssh2.h
  101. -include $(OBJDIR)/version.inc
  102. # Global flags for all compilers
  103. CFLAGS += $(OPT) -D$(DB) -DNETWARE -nostdinc
  104. ifeq ($(CC),mwccnlm)
  105. LD = mwldnlm
  106. LDFLAGS = -nostdlib $(<:.def=.o) $(PRELUDE) $(LDLIBS) -o $@ -commandfile
  107. AR = mwldnlm
  108. ARFLAGS = -type library -w nocmdline $(OBJS) -o
  109. LIBEXT = lib
  110. CFLAGS += -msgstyle gcc -gccinc -inline off -opt nointrinsics -proc 586
  111. CFLAGS += -relax_pointers
  112. #CFLAGS += -w on
  113. ifeq ($(LIBARCH),LIBC)
  114. PRELUDE = $(SDK_LIBC)/imports/libcpre.o
  115. CFLAGS += -align 4
  116. else
  117. # PRELUDE = $(SDK_CLIB)/imports/clibpre.o
  118. # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
  119. PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
  120. # CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
  121. CFLAGS += -align 1
  122. endif
  123. else
  124. LD = nlmconv
  125. LDFLAGS = -UT
  126. AR = ar
  127. ARFLAGS = -cq
  128. LIBEXT = a
  129. CFLAGS += -m32
  130. CFLAGS += -fno-builtin -fpcc-struct-return
  131. CFLAGS += -fno-strict-aliasing
  132. CFLAGS += -Wall # -pedantic
  133. ifeq ($(LIBARCH),LIBC)
  134. PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
  135. else
  136. # PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
  137. # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
  138. # http://www.gknw.net/development/mk_nlm/gcc_pre.zip
  139. PRELUDE = $(NDK_ROOT)/pre/prelude.o
  140. CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
  141. endif
  142. endif
  143. NDK_ROOT = $(NDKBASE)/ndk
  144. SDK_CLIB = $(NDK_ROOT)/nwsdk
  145. SDK_LIBC = $(NDK_ROOT)/libc
  146. SNPRINTF = $(NDKBASE)/snprintf
  147. INCLUDES = -I.. -I../../include
  148. LDLIBS =
  149. ifdef LINK_STATIC
  150. LDLIBS += ../libssh2.$(LIBEXT)
  151. else
  152. IMPORTS += @../libssh2.imp
  153. MODULES += libssh2.nlm
  154. endif
  155. INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)
  156. LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT)
  157. LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT)
  158. IMPORTS += GetProcessSwitchCount RunningProcess
  159. ifdef WITH_ZLIB
  160. INCLUDES += -I$(ZLIB_PATH)
  161. ifdef LINK_STATIC
  162. LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT)
  163. else
  164. MODULES += libz.nlm
  165. IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp
  166. endif
  167. endif
  168. ifeq ($(LIBARCH),LIBC)
  169. INCLUDES += -I$(SDK_LIBC)/include
  170. # INCLUDES += -I$(SDK_LIBC)/include/nks
  171. # INCLUDES += -I$(SDK_LIBC)/include/winsock
  172. CFLAGS += -D_POSIX_SOURCE
  173. else
  174. INCLUDES += -I$(SDK_CLIB)/include/nlm
  175. # INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
  176. # INCLUDES += -I$(SDK_CLIB)/include
  177. # CFLAGS += -DNETDB_USE_INTERNET
  178. endif
  179. CFLAGS += $(INCLUDES)
  180. ifeq ($(MTSAFE),YES)
  181. XDCOPT = -n
  182. endif
  183. ifeq ($(MTSAFE),NO)
  184. XDCOPT = -u
  185. endif
  186. vpath %.c $(SAMPLES)
  187. .PRECIOUS: $(OBJDIR)/%.o $(OBJDIR)/%.def $(OBJDIR)/%.xdc
  188. all: prebuild $(TARGETS)
  189. prebuild: $(OBJDIR) $(OBJDIR)/version.inc
  190. $(OBJDIR)/%.o: %.c
  191. # @echo Compiling $<
  192. $(CC) $(CFLAGS) -c $< -o $@
  193. $(OBJDIR)/version.inc: ../../get_ver.awk ../../include/libssh2.h $(OBJDIR)
  194. @echo Creating $@
  195. @$(AWK) -f $^ > $@
  196. objclean:
  197. $(call RMDIR, $(OBJDIR))
  198. clean: objclean
  199. $(foreach f, $(TARGETS), $(call DEL, $(f)))
  200. $(OBJDIR):
  201. @$(call MKDIR, $@)
  202. %.nlm: $(OBJDIR)/%.def $(OBJDIR)/%.o $(OBJDIR)/%.xdc
  203. @echo Linking $@
  204. @$(call DEL, $@)
  205. @$(LD) $(LDFLAGS) $<
  206. $(OBJDIR)/%.xdc: GNUmakefile
  207. @echo Creating $@
  208. @$(MPKXDC) $(XDCOPT) $@
  209. $(OBJDIR)/%.def: GNUmakefile
  210. @echo $(DL)# DEF file for linking with $(LD)$(DL) > $@
  211. @echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@
  212. @echo $(DL)# All your changes will be lost!!$(DL) >> $@
  213. @echo $(DL)#$(DL) >> $@
  214. @echo $(DL)copyright "$(COPYR)"$(DL) >> $@
  215. @echo $(DL)description "$(DESCR)"$(DL) >> $@
  216. @echo $(DL)version $(VERSION)$(DL) >> $@
  217. ifdef NLMTYPE
  218. @echo $(DL)type $(NLMTYPE)$(DL) >> $@
  219. endif
  220. ifdef STACK
  221. @echo $(DL)stack $(STACK)$(DL) >> $@
  222. endif
  223. ifdef SCREEN
  224. @echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
  225. else
  226. @echo $(DL)screenname "DEFAULT"$(DL) >> $@
  227. endif
  228. ifeq ($(DB),DEBUG)
  229. @echo $(DL)debug$(DL) >> $@
  230. endif
  231. @echo $(DL)threadname "$(notdir $(@:.def=))"$(DL) >> $@
  232. ifdef XDCOPT
  233. @echo $(DL)xdcdata $(@:.def=.xdc)$(DL) >> $@
  234. endif
  235. ifeq ($(LDRING),0)
  236. @echo $(DL)flag_on 16$(DL) >> $@
  237. endif
  238. ifeq ($(LDRING),3)
  239. @echo $(DL)flag_on 512$(DL) >> $@
  240. endif
  241. ifeq ($(LIBARCH),CLIB)
  242. @echo $(DL)start _Prelude$(DL) >> $@
  243. @echo $(DL)exit _Stop$(DL) >> $@
  244. @echo $(DL)import @$(SDK_CLIB)/imports/clib.imp$(DL) >> $@
  245. @echo $(DL)import @$(SDK_CLIB)/imports/threads.imp$(DL) >> $@
  246. @echo $(DL)import @$(SDK_CLIB)/imports/nlmlib.imp$(DL) >> $@
  247. @echo $(DL)import @$(SDK_CLIB)/imports/socklib.imp$(DL) >> $@
  248. @echo $(DL)module clib$(DL) >> $@
  249. else
  250. @echo $(DL)flag_on 64$(DL) >> $@
  251. @echo $(DL)pseudopreemption$(DL) >> $@
  252. @echo $(DL)start _LibCPrelude$(DL) >> $@
  253. @echo $(DL)exit _LibCPostlude$(DL) >> $@
  254. @echo $(DL)check _LibCCheckUnload$(DL) >> $@
  255. @echo $(DL)import @$(SDK_LIBC)/imports/libc.imp$(DL) >> $@
  256. @echo $(DL)import @$(SDK_LIBC)/imports/netware.imp$(DL) >> $@
  257. @echo $(DL)module libc$(DL) >> $@
  258. endif
  259. ifdef MODULES
  260. @echo $(DL)module $(MODULES)$(DL) >> $@
  261. endif
  262. ifdef EXPORTS
  263. @echo $(DL)export $(EXPORTS)$(DL) >> $@
  264. endif
  265. ifdef IMPORTS
  266. @echo $(DL)import $(IMPORTS)$(DL) >> $@
  267. endif
  268. ifeq ($(LD),nlmconv)
  269. @echo $(DL)input $(@:.def=.o)$(DL) >> $@
  270. @echo $(DL)input $(PRELUDE)$(DL) >> $@
  271. ifdef LDLIBS
  272. @echo $(DL)input $(LDLIBS)$(DL) >> $@
  273. endif
  274. @echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@
  275. endif