1 ##############################################################################
2 # Copyright 2020 Thomas E. Dickey #
3 # Copyright 1998-2000,2006 Free Software Foundation, Inc. #
5 # Permission is hereby granted, free of charge, to any person obtaining a #
6 # copy of this software and associated documentation files (the "Software"), #
7 # to deal in the Software without restriction, including without limitation #
8 # the rights to use, copy, modify, merge, publish, distribute, distribute #
9 # with modifications, sublicense, and/or sell copies of the Software, and to #
10 # permit persons to whom the Software is furnished to do so, subject to the #
11 # following conditions: #
13 # The above copyright notice and this permission notice shall be included in #
14 # all copies or substantial portions of the Software. #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
19 # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
21 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
22 # DEALINGS IN THE SOFTWARE. #
24 # Except as contained in this notice, the name(s) of the above copyright #
25 # holders shall not be used in advertising or otherwise to promote the sale, #
26 # use or other dealings in this Software without prior written #
28 ################################################################################
29 # $Id: Makefile.os2,v 1.12 2020/02/02 23:34:34 tom Exp $
31 # Wrapper Makefile for ncurses library under OS/2.
32 # Author: Juan Jose Garcia Ripoll <worm@arrakis.es>.
33 # Webpage: http://www.arrakis.es/~worm/
34 ################################################################################
36 # Notes (from I Zakharevich)
37 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
38 # I could build the library with the following sequence of commands:
41 # make -f Makefile.os2 config
42 # make -f Makefile.os2 CC=gcc HOSTCC=gcc CXX=gcc
44 # Ignoring the following errors:
45 # Invalid configuration `os2'...
46 # ... ac_maketemp="make": not found
47 # ... syntax error: `done' unexpected
48 # No rule to make target `lib/ncurses4.dll'
53 # make -f Makefile.os2 make.defs
55 # if the build of misc/panel.def fails.
57 # If you do not have perl, the configuration will fail. Use autoconf to
58 # generate the EMX-specific configure script (see README.emx), and run the
59 # configure script to generate the makefiles. Then, run
61 # make -f Makefile.os2 make.dlls
63 # Notes (from J J G Ripoll)
64 # ~~~~~~~~~~~~~~~~~~~~~~~~~
65 # The `make.defs' rule creates the new '.def' files and outputs a diagnostic
66 # about symbols that disappear from one release to the other, as well as
67 # checks about the new '.def' consistency. If there were no problems, the
68 # maintainer is free to replace the `.ref' files with the newer ones using the
69 # `save.defs' rule. So, the only tough work is ensuring that the symbols that
70 # disappear are not essential.
72 # I first thought about killing '_nc_*' symbols, but it seems that some of
73 # them --_nc_panel_hook, _nc_ada*, etc-- are needed outside ncurses.dll.
74 # However, the whole size of the export table will not be larger than 1k or
79 # The way things are handled in misc/Makefile is not well suited for OS/2,
80 # where only emx.src is needed. Thus, I've written a few wrapper rules in
81 # Makefile.os2 that handle installation/deinstallation.
85 # There's also a new rule that configures and builds a sort of binary
86 # distribution, much like the one I prepared for 1.9.9e. It's `os2dist'.
88 ################################################################################
92 # This is for configuring
94 # What is a useful value for this?
95 CONFIG_OPTS = --enable-termcap
98 DLL_LN_OPTS = -Zcrtdll -Zdll -Zomf -Zmt
102 config.cache: configure.cmd configure
104 configure.cmd $(CONFIG_OPTS)
106 configure.cmd: configure convert_configure.pl
107 perl convert_configure.pl configure > $@
109 convert_configure.pl:
110 $(WWWGET) ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2/$@ > $@
114 echo *** Do not use this command. Use install.os2 instead.
118 install.os2 : install.emxdata install.libs install.progs
125 # DLLs and that stuff
128 LIBRARIES = ncurses form menu panel
130 DLL_TAG = $(NCURSES_MAJOR)
133 DLL_ROOTS = $(addsuffix $(DLL_TAG), $(LIBRARIES))
134 DLLS = $(addsuffix .dll, $(addprefix ./lib/, $(DLL_ROOTS)))
136 LIB_ROOTS = $(addsuffix $(LIB_TAG), $(LIBRARIES))
137 LIBS = $(addsuffix .lib, $(addprefix ./lib/, $(LIB_ROOTS)))
139 LIBS_AOUT = $(addsuffix .a, $(addprefix ./lib/, $(LIB_ROOTS)))
141 DEFS = $(addsuffix .def, $(addprefix ./misc/, $(LIBRARIES)))
143 DLL_SIGNATURE = NCurses-$(NCURSES_MAJOR)-$(NCURSES_MINOR)-$(NCURSES_PATCH)
145 ./lib/%$(LIB_TAG).lib : ./misc/%.def
148 ./lib/%$(LIB_TAG).a : ./misc/%.def
151 ./lib/%$(DLL_TAG).dll : ./lib/%.a
152 emxomf -o ./lib/$*$(DLL_TAG).lib $<
153 if [ "$*" = "ncurses" ]; then \
154 gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \
155 ./misc/$*.def -o $@; \
157 gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \
158 ./lib/ncurses$(LIB_TAG).lib ./misc/$*.def -o $@; \
160 -rm -f ./lib/$*$(DLL_TAG).lib
162 make.dlls : $(DEFS) $(LIBS) $(DLLS) $(LIBS_AOUT)
166 LIBDIR = $(DESTDIR)$(libdir)
170 install.libs :: $(LIBS) $(DLLS) $(LIBDIR)
171 @for i in $(DLL_ROOTS); do \
172 echo installing ./lib/$$i.dll as $(LIBDIR)/$$i.dll; \
173 $(INSTALL_DATA) ./lib/$$i.dll $(LIBDIR)/$$i.dll; done
174 @for i in $(LIB_ROOTS); do \
175 echo installing ./lib/$$i.lib as $(LIBDIR)/$$i.lib; \
176 $(INSTALL_DATA) ./lib/$$i.lib $(LIBDIR)/$$i.lib; done
179 -@for i in $(DLL_ROOTS); do \
180 echo uninstalling $(LIBDIR)/$$i.dll; \
181 rm -f $(LIBDIR)/$$i.dll; done
182 -@for i in $(LIB_ROOTS); do \
183 echo uninstalling $(LIBDIR)/$$i.lib; \
184 rm -f $(LIBDIR)/$$i.lib; done
187 for i in $(LIBRARIES); do \
188 echo LIBRARY $${i}$(DLL_TAG) INITINSTANCE TERMINSTANCE > ./misc/$$i.def; \
189 echo DESCRIPTION \"$(DLL_SIGNATURE), module $$i\" >> ./misc/$$i.def; \
190 echo CODE LOADONCALL >> ./misc/$$i.def; \
191 echo DATA LOADONCALL NONSHARED MULTIPLE >> ./misc/$$i.def; \
192 echo EXPORTS >> ./misc/$$i.def; \
193 echo Creating $$i.def; \
194 (cmd /C ".\\misc\\makedef.cmd ./lib/$$i.a ./misc/$$i.ref >> ./misc/$$i.def" \
195 && cmd /C ".\\misc\\chkdef.cmd ./misc/$$i.def") \
201 for i in $(LIBRARIES); do \
202 test -f ./misc/$$i.def && cp ./misc/$$i.def ./misc/$$i.ref; \
207 -rm -f $(DLLS) $(LIBS)
210 -rm -f $(addprefix ./misc/, $(addsuffix .def, $(LIBRARIES)))
213 # This is a simplified version of misc/Makefile
216 TICDIR = $(DESTDIR)$(datadir)/terminfo
217 TABSETDIR = $(DESTDIR)$(datadir)/tabset
223 install.emxdata :: $(TICDIR)
225 echo Building terminfo database, please wait...
226 set TERMINFO=$(TICDIR); ./progs/tic ./misc/emx.src
227 echo Installing the terminfo cleaner and the sources...
228 cp ./misc/emx.src ./misc/cleantic.cmd $(TICDIR)
229 ./misc/cleantic.cmd $(TICDIR)
233 -cd $(TICDIR) && rm -rf *
234 -cd $(TABSETDIR) && rm -rf *
237 # This is for preparing binary distributions
240 OS2NAME=ncurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-emx
243 # FIXME: this assumes that we can rerun the configure script, changing only
244 # the install-prefix. That means we cannot provide "interesting" options
248 $(MAKE) -f Makefile.os2 os2clean
249 ./configure --without-debug --with-install-prefix=`pwd|sed -e 's@^.:@@'`/$(OS2NAME)
250 $(MAKE) -f Makefile.os2 $(CF_MFLAGS) install.os2
251 -rm -f $(OS2NAME).zip
252 echo NCurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-$(NCURSES_PATCH) for emx > $(OS2NAME)/FILE_ID.DIZ
253 echo Binary release. >> $(OS2NAME)/FILE_ID.DIZ
254 zip -r $(OS2NAME).zip ./$(OS2NAME)
259 -rm -f $(OS2NAME).zip