Makefile.os2 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. ##############################################################################
  2. # Copyright (c) 1998-2000,2006 Free Software Foundation, Inc. #
  3. # #
  4. # Permission is hereby granted, free of charge, to any person obtaining a #
  5. # copy of this software and associated documentation files (the "Software"), #
  6. # to deal in the Software without restriction, including without limitation #
  7. # the rights to use, copy, modify, merge, publish, distribute, distribute #
  8. # with modifications, sublicense, and/or sell copies of the Software, and to #
  9. # permit persons to whom the Software is furnished to do so, subject to the #
  10. # following conditions: #
  11. # #
  12. # The above copyright notice and this permission notice shall be included in #
  13. # all copies or substantial portions of the Software. #
  14. # #
  15. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
  16. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
  17. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
  18. # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
  19. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
  20. # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
  21. # DEALINGS IN THE SOFTWARE. #
  22. # #
  23. # Except as contained in this notice, the name(s) of the above copyright #
  24. # holders shall not be used in advertising or otherwise to promote the sale, #
  25. # use or other dealings in this Software without prior written #
  26. # authorization. #
  27. ################################################################################
  28. # $Id: Makefile.os2,v 1.11 2006/04/22 21:46:17 tom Exp $
  29. #
  30. # Wrapper Makefile for ncurses library under OS/2.
  31. # Author: Juan Jose Garcia Ripoll <worm@arrakis.es>.
  32. # Webpage: http://www.arrakis.es/~worm/
  33. ################################################################################
  34. #
  35. # Notes (from I Zakharevich)
  36. # ~~~~~~~~~~~~~~~~~~~~~~~~~~
  37. # I could build the library with the following sequence of commands:
  38. #
  39. # touch Makefile
  40. # make -f Makefile.os2 config
  41. # make -f Makefile.os2 CC=gcc HOSTCC=gcc CXX=gcc
  42. #
  43. # Ignoring the following errors:
  44. # Invalid configuration `os2'...
  45. # ... ac_maketemp="make": not found
  46. # ... syntax error: `done' unexpected
  47. # No rule to make target `lib/ncurses4.dll'
  48. #
  49. # You may need to run
  50. #
  51. # rm make.defs
  52. # make -f Makefile.os2 make.defs
  53. #
  54. # if the build of misc/panel.def fails.
  55. #
  56. # If you do not have perl, the configuration will fail. Use autoconf to
  57. # generate the EMX-specific configure script (see README.emx), and run the
  58. # configure script to generate the makefiles. Then, run
  59. #
  60. # make -f Makefile.os2 make.dlls
  61. #
  62. # Notes (from J J G Ripoll)
  63. # ~~~~~~~~~~~~~~~~~~~~~~~~~
  64. # The `make.defs' rule creates the new '.def' files and outputs a diagnostic
  65. # about symbols that disappear from one release to the other, as well as
  66. # checks about the new '.def' consistency. If there were no problems, the
  67. # maintainer is free to replace the `.ref' files with the newer ones using the
  68. # `save.defs' rule. So, the only tough work is ensuring that the symbols that
  69. # disappear are not essential.
  70. #
  71. # I first thought about killing '_nc_*' symbols, but it seems that some of
  72. # them --_nc_panel_hook, _nc_ada*, etc-- are needed outside ncurses.dll.
  73. # However, the whole size of the export table will not be larger than 1k or
  74. # so.
  75. #
  76. # [installation]
  77. #
  78. # The way things are handled in misc/Makefile is not well suited for OS/2,
  79. # where only emx.src is needed. Thus, I've written a few wrapper rules in
  80. # Makefile.os2 that handle installation/deinstallation.
  81. #
  82. # [distribution]
  83. #
  84. # There's also a new rule that configures and builds a sort of binary
  85. # distribution, much like the one I prepared for 1.9.9e. It's `os2dist'.
  86. #
  87. ################################################################################
  88. all :: config
  89. # This is for configuring
  90. # What is a useful value for this?
  91. CONFIG_OPTS = --enable-termcap
  92. WWWGET = lynx -source
  93. MV_F = mv -f
  94. DLL_LN_OPTS = -Zcrtdll -Zdll -Zomf -Zmt
  95. config: config.cache
  96. config.cache: configure.cmd configure
  97. -$(MV_F) $@ $@.ref
  98. configure.cmd $(CONFIG_OPTS)
  99. configure.cmd: configure convert_configure.pl
  100. perl convert_configure.pl configure > $@
  101. convert_configure.pl:
  102. $(WWWGET) ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2/$@ > $@
  103. install ::
  104. echo ***
  105. echo *** Do not use this command. Use install.os2 instead.
  106. echo ***
  107. exit 2
  108. install.os2 : install.emxdata install.libs install.progs
  109. include ./Makefile
  110. all :: make.dlls
  111. #
  112. # DLLs and that stuff
  113. #
  114. LIBRARIES = ncurses form menu panel
  115. DLL_TAG = $(NCURSES_MAJOR)
  116. LIB_TAG = _s
  117. DLL_ROOTS = $(addsuffix $(DLL_TAG), $(LIBRARIES))
  118. DLLS = $(addsuffix .dll, $(addprefix ./lib/, $(DLL_ROOTS)))
  119. LIB_ROOTS = $(addsuffix $(LIB_TAG), $(LIBRARIES))
  120. LIBS = $(addsuffix .lib, $(addprefix ./lib/, $(LIB_ROOTS)))
  121. LIBS_AOUT = $(addsuffix .a, $(addprefix ./lib/, $(LIB_ROOTS)))
  122. DEFS = $(addsuffix .def, $(addprefix ./misc/, $(LIBRARIES)))
  123. DLL_SIGNATURE = NCurses-$(NCURSES_MAJOR)-$(NCURSES_MINOR)-$(NCURSES_PATCH)
  124. ./lib/%$(LIB_TAG).lib : ./misc/%.def
  125. emximp -o $@ $<
  126. ./lib/%$(LIB_TAG).a : ./misc/%.def
  127. emximp -o $@ $<
  128. ./lib/%$(DLL_TAG).dll : ./lib/%.a
  129. emxomf -o ./lib/$*$(DLL_TAG).lib $<
  130. if [ "$*" = "ncurses" ]; then \
  131. gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \
  132. ./misc/$*.def -o $@; \
  133. else \
  134. gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \
  135. ./lib/ncurses$(LIB_TAG).lib ./misc/$*.def -o $@; \
  136. fi
  137. -rm -f ./lib/$*$(DLL_TAG).lib
  138. make.dlls : $(DEFS) $(LIBS) $(DLLS) $(LIBS_AOUT)
  139. $(DEFS) : make.defs
  140. LIBDIR = $(DESTDIR)$(libdir)
  141. $(LIBDIR) :
  142. mkdir -p $@
  143. install.libs :: $(LIBS) $(DLLS) $(LIBDIR)
  144. @for i in $(DLL_ROOTS); do \
  145. echo installing ./lib/$$i.dll as $(LIBDIR)/$$i.dll; \
  146. $(INSTALL_DATA) ./lib/$$i.dll $(LIBDIR)/$$i.dll; done
  147. @for i in $(LIB_ROOTS); do \
  148. echo installing ./lib/$$i.lib as $(LIBDIR)/$$i.lib; \
  149. $(INSTALL_DATA) ./lib/$$i.lib $(LIBDIR)/$$i.lib; done
  150. uninstall.libs ::
  151. -@for i in $(DLL_ROOTS); do \
  152. echo uninstalling $(LIBDIR)/$$i.dll; \
  153. rm -f $(LIBDIR)/$$i.dll; done
  154. -@for i in $(LIB_ROOTS); do \
  155. echo uninstalling $(LIBDIR)/$$i.lib; \
  156. rm -f $(LIBDIR)/$$i.lib; done
  157. make.defs :
  158. for i in $(LIBRARIES); do \
  159. echo LIBRARY $${i}$(DLL_TAG) INITINSTANCE TERMINSTANCE > ./misc/$$i.def; \
  160. echo DESCRIPTION \"$(DLL_SIGNATURE), module $$i\" >> ./misc/$$i.def; \
  161. echo CODE LOADONCALL >> ./misc/$$i.def; \
  162. echo DATA LOADONCALL NONSHARED MULTIPLE >> ./misc/$$i.def; \
  163. echo EXPORTS >> ./misc/$$i.def; \
  164. echo Creating $$i.def; \
  165. (cmd /C ".\\misc\\makedef.cmd ./lib/$$i.a ./misc/$$i.ref >> ./misc/$$i.def" \
  166. && cmd /C ".\\misc\\chkdef.cmd ./misc/$$i.def") \
  167. || exit 1; \
  168. done
  169. touch make.defs
  170. save.defs :
  171. for i in $(LIBRARIES); do \
  172. test -f ./misc/$$i.def && cp ./misc/$$i.def ./misc/$$i.ref; \
  173. done
  174. clean \
  175. os2clean ::
  176. -rm -f $(DLLS) $(LIBS)
  177. realclean ::
  178. -rm -f $(addprefix ./misc/, $(addsuffix .def, $(LIBRARIES)))
  179. #
  180. # This is a simplified version of misc/Makefile
  181. #
  182. TICDIR = $(DESTDIR)$(datadir)/terminfo
  183. TABSETDIR = $(DESTDIR)$(datadir)/tabset
  184. $(TICDIR) :
  185. mkdir -p $@
  186. install \
  187. install.emxdata :: $(TICDIR)
  188. -@rm -fr $(TICDIR)/*
  189. echo Building terminfo database, please wait...
  190. set TERMINFO=$(TICDIR); ./progs/tic ./misc/emx.src
  191. echo Installing the terminfo cleaner and the sources...
  192. cp ./misc/emx.src ./misc/cleantic.cmd $(TICDIR)
  193. ./misc/cleantic.cmd $(TICDIR)
  194. uninstall \
  195. uninstall.emxdata ::
  196. -cd $(TICDIR) && rm -rf *
  197. -cd $(TABSETDIR) && rm -rf *
  198. #
  199. # This is for preparing binary distributions
  200. #
  201. OS2NAME=ncurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-emx
  202. #
  203. # FIXME: this assumes that we can rerun the configure script, changing only
  204. # the install-prefix. That means we cannot provide "interesting" options
  205. # when building.
  206. #
  207. os2dist :
  208. $(MAKE) -f Makefile.os2 os2clean
  209. ./configure --without-debug --with-install-prefix=`pwd|sed -e 's@^.:@@'`/$(OS2NAME)
  210. $(MAKE) -f Makefile.os2 $(CF_MFLAGS) install.os2
  211. -rm -f $(OS2NAME).zip
  212. echo NCurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-$(NCURSES_PATCH) for emx > $(OS2NAME)/FILE_ID.DIZ
  213. echo Binary release. >> $(OS2NAME)/FILE_ID.DIZ
  214. zip -r $(OS2NAME).zip ./$(OS2NAME)
  215. clean \
  216. os2clean ::
  217. -rm -rf $(OS2NAME)
  218. -rm -f $(OS2NAME).zip