1 ##############################################################################
2 # Copyright (c) 1998-2000,2006 Free Software Foundation, Inc. #
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: #
12 # The above copyright notice and this permission notice shall be included in #
13 # all copies or substantial portions of the Software. #
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. #
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 #
27 ################################################################################
28 # $Id: Makefile.os2,v 1.11 2006/04/22 21:46:17 tom Exp $
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 ################################################################################
35 # Notes (from I Zakharevich)
36 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
37 # I could build the library with the following sequence of commands:
40 # make -f Makefile.os2 config
41 # make -f Makefile.os2 CC=gcc HOSTCC=gcc CXX=gcc
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'
52 # make -f Makefile.os2 make.defs
54 # if the build of misc/panel.def fails.
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
60 # make -f Makefile.os2 make.dlls
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.
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
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.
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'.
87 ################################################################################
91 # This is for configuring
93 # What is a useful value for this?
94 CONFIG_OPTS = --enable-termcap
97 DLL_LN_OPTS = -Zcrtdll -Zdll -Zomf -Zmt
101 config.cache: configure.cmd configure
103 configure.cmd $(CONFIG_OPTS)
105 configure.cmd: configure convert_configure.pl
106 perl convert_configure.pl configure > $@
108 convert_configure.pl:
109 $(WWWGET) ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2/$@ > $@
113 echo *** Do not use this command. Use install.os2 instead.
117 install.os2 : install.emxdata install.libs install.progs
124 # DLLs and that stuff
127 LIBRARIES = ncurses form menu panel
129 DLL_TAG = $(NCURSES_MAJOR)
132 DLL_ROOTS = $(addsuffix $(DLL_TAG), $(LIBRARIES))
133 DLLS = $(addsuffix .dll, $(addprefix ./lib/, $(DLL_ROOTS)))
135 LIB_ROOTS = $(addsuffix $(LIB_TAG), $(LIBRARIES))
136 LIBS = $(addsuffix .lib, $(addprefix ./lib/, $(LIB_ROOTS)))
138 LIBS_AOUT = $(addsuffix .a, $(addprefix ./lib/, $(LIB_ROOTS)))
140 DEFS = $(addsuffix .def, $(addprefix ./misc/, $(LIBRARIES)))
142 DLL_SIGNATURE = NCurses-$(NCURSES_MAJOR)-$(NCURSES_MINOR)-$(NCURSES_PATCH)
144 ./lib/%$(LIB_TAG).lib : ./misc/%.def
147 ./lib/%$(LIB_TAG).a : ./misc/%.def
150 ./lib/%$(DLL_TAG).dll : ./lib/%.a
151 emxomf -o ./lib/$*$(DLL_TAG).lib $<
152 if [ "$*" = "ncurses" ]; then \
153 gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \
154 ./misc/$*.def -o $@; \
156 gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \
157 ./lib/ncurses$(LIB_TAG).lib ./misc/$*.def -o $@; \
159 -rm -f ./lib/$*$(DLL_TAG).lib
161 make.dlls : $(DEFS) $(LIBS) $(DLLS) $(LIBS_AOUT)
165 LIBDIR = $(DESTDIR)$(libdir)
169 install.libs :: $(LIBS) $(DLLS) $(LIBDIR)
170 @for i in $(DLL_ROOTS); do \
171 echo installing ./lib/$$i.dll as $(LIBDIR)/$$i.dll; \
172 $(INSTALL_DATA) ./lib/$$i.dll $(LIBDIR)/$$i.dll; done
173 @for i in $(LIB_ROOTS); do \
174 echo installing ./lib/$$i.lib as $(LIBDIR)/$$i.lib; \
175 $(INSTALL_DATA) ./lib/$$i.lib $(LIBDIR)/$$i.lib; done
178 -@for i in $(DLL_ROOTS); do \
179 echo uninstalling $(LIBDIR)/$$i.dll; \
180 rm -f $(LIBDIR)/$$i.dll; done
181 -@for i in $(LIB_ROOTS); do \
182 echo uninstalling $(LIBDIR)/$$i.lib; \
183 rm -f $(LIBDIR)/$$i.lib; done
186 for i in $(LIBRARIES); do \
187 echo LIBRARY $${i}$(DLL_TAG) INITINSTANCE TERMINSTANCE > ./misc/$$i.def; \
188 echo DESCRIPTION \"$(DLL_SIGNATURE), module $$i\" >> ./misc/$$i.def; \
189 echo CODE LOADONCALL >> ./misc/$$i.def; \
190 echo DATA LOADONCALL NONSHARED MULTIPLE >> ./misc/$$i.def; \
191 echo EXPORTS >> ./misc/$$i.def; \
192 echo Creating $$i.def; \
193 (cmd /C ".\\misc\\makedef.cmd ./lib/$$i.a ./misc/$$i.ref >> ./misc/$$i.def" \
194 && cmd /C ".\\misc\\chkdef.cmd ./misc/$$i.def") \
200 for i in $(LIBRARIES); do \
201 test -f ./misc/$$i.def && cp ./misc/$$i.def ./misc/$$i.ref; \
206 -rm -f $(DLLS) $(LIBS)
209 -rm -f $(addprefix ./misc/, $(addsuffix .def, $(LIBRARIES)))
212 # This is a simplified version of misc/Makefile
215 TICDIR = $(DESTDIR)$(datadir)/terminfo
216 TABSETDIR = $(DESTDIR)$(datadir)/tabset
222 install.emxdata :: $(TICDIR)
224 echo Building terminfo database, please wait...
225 set TERMINFO=$(TICDIR); ./progs/tic ./misc/emx.src
226 echo Installing the terminfo cleaner and the sources...
227 cp ./misc/emx.src ./misc/cleantic.cmd $(TICDIR)
228 ./misc/cleantic.cmd $(TICDIR)
232 -cd $(TICDIR) && rm -rf *
233 -cd $(TABSETDIR) && rm -rf *
236 # This is for preparing binary distributions
239 OS2NAME=ncurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-emx
242 # FIXME: this assumes that we can rerun the configure script, changing only
243 # the install-prefix. That means we cannot provide "interesting" options
247 $(MAKE) -f Makefile.os2 os2clean
248 ./configure --without-debug --with-install-prefix=`pwd|sed -e 's@^.:@@'`/$(OS2NAME)
249 $(MAKE) -f Makefile.os2 $(CF_MFLAGS) install.os2
250 -rm -f $(OS2NAME).zip
251 echo NCurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-$(NCURSES_PATCH) for emx > $(OS2NAME)/FILE_ID.DIZ
252 echo Binary release. >> $(OS2NAME)/FILE_ID.DIZ
253 zip -r $(OS2NAME).zip ./$(OS2NAME)
258 -rm -f $(OS2NAME).zip