1 ################################################################################
2 # Wrapper Makefile for ncurses library under OS/2.
3 ################################################################################
4 # $Id: Makefile.os2,v 1.10 2000/10/09 23:53:57 Ilya.Zakharevich Exp $
6 # Author: Juan Jose Garcia Ripoll <worm@arrakis.es>.
7 # Webpage: http://www.arrakis.es/~worm/
8 ################################################################################
10 # Notes (from I Zakharevich)
11 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
12 # I could build the library with the following sequence of commands:
15 # make -f Makefile.os2 config
16 # make -f Makefile.os2 CC=gcc HOSTCC=gcc CXX=gcc
18 # Ignoring the following errors:
19 # Invalid configuration `os2'...
20 # ... ac_maketemp="make": not found
21 # ... syntax error: `done' unexpected
22 # No rule to make target `lib/ncurses4.dll'
27 # make -f Makefile.os2 make.defs
29 # if the build of misc/panel.def fails.
31 # If you do not have perl, the configuration will fail. Use autoconf to
32 # generate the EMX-specific configure script (see README.emx), and run the
33 # configure script to generate the makefiles. Then, run
35 # make -f Makefile.os2 make.dlls
37 # Notes (from J J G Ripoll)
38 # ~~~~~~~~~~~~~~~~~~~~~~~~~
39 # The `make.defs' rule creates the new '.def' files and outputs a diagnostic
40 # about symbols that disappear from one release to the other, as well as
41 # checks about the new '.def' consistency. If there were no problems, the
42 # maintainer is free to replace the `.ref' files with the newer ones using the
43 # `save.defs' rule. So, the only tough work is ensuring that the symbols that
44 # disappear are not essential.
46 # I first thought about killing '_nc_*' symbols, but it seems that some of
47 # them --_nc_panel_hook, _nc_ada*, etc-- are needed outside ncurses.dll.
48 # However, the whole size of the export table will not be larger than 1k or
53 # The way things are handled in misc/Makefile is not well suited for OS/2,
54 # where only emx.src is needed. Thus, I've written a few wrapper rules in
55 # Makefile.os2 that handle installation/deinstallation.
59 # There's also a new rule that configures and builds a sort of binary
60 # distribution, much like the one I prepared for 1.9.9e. It's `os2dist'.
62 ################################################################################
66 # This is for configuring
68 # What is a useful value for this?
69 CONFIG_OPTS = --enable-termcap
72 DLL_LN_OPTS = -Zcrtdll -Zdll -Zomf -Zmt
76 config.cache: configure.cmd configure
78 configure.cmd $(CONFIG_OPTS)
80 configure.cmd: configure convert_configure.pl
81 perl convert_configure.pl configure > $@
84 $(WWWGET) ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2/$@ > $@
88 echo *** Do not use this command. Use install.os2 instead.
92 install.os2 : install.emxdata install.libs install.progs
102 LIBRARIES = ncurses form menu panel
104 DLL_TAG = $(NCURSES_MAJOR)
107 DLL_ROOTS = $(addsuffix $(DLL_TAG), $(LIBRARIES))
108 DLLS = $(addsuffix .dll, $(addprefix ./lib/, $(DLL_ROOTS)))
110 LIB_ROOTS = $(addsuffix $(LIB_TAG), $(LIBRARIES))
111 LIBS = $(addsuffix .lib, $(addprefix ./lib/, $(LIB_ROOTS)))
113 LIBS_AOUT = $(addsuffix .a, $(addprefix ./lib/, $(LIB_ROOTS)))
115 DEFS = $(addsuffix .def, $(addprefix ./misc/, $(LIBRARIES)))
117 DLL_SIGNATURE = NCurses-$(NCURSES_MAJOR)-$(NCURSES_MINOR)-$(NCURSES_PATCH)
119 ./lib/%$(LIB_TAG).lib : ./misc/%.def
122 ./lib/%$(LIB_TAG).a : ./misc/%.def
125 ./lib/%$(DLL_TAG).dll : ./lib/%.a
126 emxomf -o ./lib/$*$(DLL_TAG).lib $<
127 if [ "$*" = "ncurses" ]; then \
128 gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \
129 ./misc/$*.def -o $@; \
131 gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \
132 ./lib/ncurses$(LIB_TAG).lib ./misc/$*.def -o $@; \
134 -rm -f ./lib/$*$(DLL_TAG).lib
136 make.dlls : $(DEFS) $(LIBS) $(DLLS) $(LIBS_AOUT)
140 LIBDIR = $(DESTDIR)$(libdir)
144 install.libs :: $(LIBS) $(DLLS) $(LIBDIR)
145 @for i in $(DLL_ROOTS); do \
146 echo installing ./lib/$$i.dll as $(LIBDIR)/$$i.dll; \
147 $(INSTALL_DATA) ./lib/$$i.dll $(LIBDIR)/$$i.dll; done
148 @for i in $(LIB_ROOTS); do \
149 echo installing ./lib/$$i.lib as $(LIBDIR)/$$i.lib; \
150 $(INSTALL_DATA) ./lib/$$i.lib $(LIBDIR)/$$i.lib; done
153 -@for i in $(DLL_ROOTS); do \
154 echo uninstalling $(LIBDIR)/$$i.dll; \
155 rm -f $(LIBDIR)/$$i.dll; done
156 -@for i in $(LIB_ROOTS); do \
157 echo uninstalling $(LIBDIR)/$$i.lib; \
158 rm -f $(LIBDIR)/$$i.lib; done
161 for i in $(LIBRARIES); do \
162 echo LIBRARY $${i}$(DLL_TAG) INITINSTANCE TERMINSTANCE > ./misc/$$i.def; \
163 echo DESCRIPTION \"$(DLL_SIGNATURE), module $$i\" >> ./misc/$$i.def; \
164 echo CODE LOADONCALL >> ./misc/$$i.def; \
165 echo DATA LOADONCALL NONSHARED MULTIPLE >> ./misc/$$i.def; \
166 echo EXPORTS >> ./misc/$$i.def; \
167 echo Creating $$i.def; \
168 (cmd /C ".\\misc\\makedef.cmd ./lib/$$i.a ./misc/$$i.ref >> ./misc/$$i.def" \
169 && cmd /C ".\\misc\\chkdef.cmd ./misc/$$i.def") \
175 for i in $(LIBRARIES); do \
176 test -f ./misc/$$i.def && cp ./misc/$$i.def ./misc/$$i.ref; \
181 -rm -f $(DLLS) $(LIBS)
184 -rm -f $(addprefix ./misc/, $(addsuffix .def, $(LIBRARIES)))
187 # This is a simplified version of misc/Makefile
190 TICDIR = $(DESTDIR)$(datadir)/terminfo
191 TABSETDIR = $(DESTDIR)$(datadir)/tabset
197 install.emxdata :: $(TICDIR)
199 echo Building terminfo database, please wait...
200 set TERMINFO=$(TICDIR); ./progs/tic ./misc/emx.src
201 echo Installing the terminfo cleaner and the sources...
202 cp ./misc/emx.src ./misc/cleantic.cmd $(TICDIR)
203 ./misc/cleantic.cmd $(TICDIR)
207 -cd $(TICDIR) && rm -rf *
208 -cd $(TABSETDIR) && rm -rf *
211 # This is for preparing binary distributions
214 OS2NAME=ncurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-emx
217 # FIXME: this assumes that we can rerun the configure script, changing only
218 # the install-prefix. That means we cannot provide "interesting" options
222 $(MAKE) -f Makefile.os2 os2clean
223 ./configure --without-debug --with-install-prefix=`pwd|sed -e 's@^.:@@'`/$(OS2NAME)
224 $(MAKE) -f Makefile.os2 $(CF_MFLAGS) install.os2
225 -rm -f $(OS2NAME).zip
226 echo NCurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-$(NCURSES_PATCH) for emx > $(OS2NAME)/FILE_ID.DIZ
227 echo Binary release. >> $(OS2NAME)/FILE_ID.DIZ
228 zip -r $(OS2NAME).zip ./$(OS2NAME)
233 -rm -f $(OS2NAME).zip