1 ################################################################################
2 # Wrapper Makefile for ncurses library under OS/2.
3 ################################################################################
4 # $Id: Makefile.os2,v 1.8 1998/12/13 02:23:13 tom 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
17 # make -f Makefile.os2 CC=gcc HOSTCC=gcc
19 # Ignoring the following errors:
20 # Invalid configuration `os2'...
21 # ... ac_maketemp="make": not found
22 # ... syntax error: `done' unexpected
23 # No rule to make target `lib/ncurses4.dll'
28 # make -f Makefile.os2 make.defs
30 # if the build of misc/panel.def fails.
32 # If you do not have perl, the configuration will fail. Use autoconf to
33 # generate the EMX-specific configure script (see README.emx), and run the
34 # configure script to generate the makefiles. Then, run
36 # make -f Makefile.os2 make.dlls
38 # Notes (from J J G Ripoll)
39 # ~~~~~~~~~~~~~~~~~~~~~~~~~
40 # The `make.defs' rule creates the new '.def' files and outputs a diagnostic
41 # about symbols that disappear from one release to the other, as well as
42 # checks about the new '.def' consistency. If there were no problems, the
43 # maintainer is free to replace the `.ref' files with the newer ones using the
44 # `save.defs' rule. So, the only tough work is ensuring that the symbols that
45 # disappear are not essential.
47 # I first thought about killing '_nc_*' symbols, but it seems that some of
48 # them --_nc_panel_hook, _nc_ada*, etc-- are needed outside ncurses.dll.
49 # However, the whole size of the export table will not be larger than 1k or
54 # The way things are handled in misc/Makefile is not well suited for OS/2,
55 # where only emx.src is needed. Thus, I've written a few wrapper rules in
56 # Makefile.os2 that handle installation/deinstallation.
60 # There's also a new rule that configures and builds a sort of binary
61 # distribution, much like the one I prepared for 1.9.9e. It's `os2dist'.
63 ################################################################################
67 # This is for configuring
69 # What is a useful value for this?
70 CONFIG_OPTS = --enable-termcap
73 DLL_LN_OPTS = -Zcrtdll -Zdll -Zomf -Zmt
77 config.cache: configure.cmd configure
79 configure.cmd $(CONFIG_OPTS)
81 configure.cmd: configure convert_configure.pl
82 perl convert_configure.pl configure > $@
85 $(WWWGET) ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2/$@ > $@
89 echo *** Do not use this command. Use install.os2 instead.
93 install.os2 : install.emxdata install.libs install.progs
100 # DLLs and that stuff
103 LIBRARIES = ncurses form menu panel
105 DLL_TAG = $(NCURSES_MAJOR)
108 DLL_ROOTS = $(addsuffix $(DLL_TAG), $(LIBRARIES))
109 DLLS = $(addsuffix .dll, $(addprefix ./lib/, $(DLL_ROOTS)))
111 LIB_ROOTS = $(addsuffix $(LIB_TAG), $(LIBRARIES))
112 LIBS = $(addsuffix .lib, $(addprefix ./lib/, $(LIB_ROOTS)))
114 LIBS_AOUT = $(addsuffix .a, $(addprefix ./lib/, $(LIB_ROOTS)))
116 DEFS = $(addsuffix .def, $(addprefix ./misc/, $(LIBRARIES)))
118 DLL_SIGNATURE = NCurses-$(NCURSES_MAJOR)-$(NCURSES_MINOR)-$(NCURSES_PATCH)
120 ./lib/%$(LIB_TAG).lib : ./misc/%.def
123 ./lib/%$(LIB_TAG).a : ./misc/%.def
126 ./lib/%$(DLL_TAG).dll : ./lib/%.a
127 emxomf -o ./lib/$*$(DLL_TAG).lib $<
128 if [ "$*" = "ncurses" ]; then \
129 gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \
130 ./misc/$*.def -o $@; \
132 gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \
133 ./lib/ncurses$(LIB_TAG).lib ./misc/$*.def -o $@; \
135 -rm -f ./lib/$*$(DLL_TAG).lib
137 make.dlls : $(DEFS) $(LIBS) $(DLLS) $(LIBS_AOUT)
141 LIBDIR = $(INSTALL_PREFIX)$(libdir)
145 install.libs :: $(LIBS) $(DLLS) $(LIBDIR)
146 @for i in $(DLL_ROOTS); do \
147 echo installing ./lib/$$i.dll as $(LIBDIR)/$$i.dll; \
148 $(INSTALL_DATA) ./lib/$$i.dll $(LIBDIR)/$$i.dll; done
149 @for i in $(LIB_ROOTS); do \
150 echo installing ./lib/$$i.lib as $(LIBDIR)/$$i.lib; \
151 $(INSTALL_DATA) ./lib/$$i.lib $(LIBDIR)/$$i.lib; done
154 -@for i in $(DLL_ROOTS); do \
155 echo uninstalling $(LIBDIR)/$$i.dll; \
156 rm -f $(LIBDIR)/$$i.dll; done
157 -@for i in $(LIB_ROOTS); do \
158 echo uninstalling $(LIBDIR)/$$i.lib; \
159 rm -f $(LIBDIR)/$$i.lib; done
162 for i in $(LIBRARIES); do \
163 echo LIBRARY $${i}$(DLL_TAG) INITINSTANCE TERMINSTANCE > ./misc/$$i.def; \
164 echo DESCRIPTION \"$(DLL_SIGNATURE), module $$i\" >> ./misc/$$i.def; \
165 echo CODE LOADONCALL >> ./misc/$$i.def; \
166 echo DATA LOADONCALL NONSHARED MULTIPLE >> ./misc/$$i.def; \
167 echo EXPORTS >> ./misc/$$i.def; \
168 echo Creating $$i.def; \
169 (cmd /C ".\\misc\\makedef.cmd ./lib/$$i.a ./misc/$$i.ref >> ./misc/$$i.def" \
170 && cmd /C ".\\misc\\chkdef.cmd ./misc/$$i.def") \
176 for i in $(LIBRARIES); do \
177 test -f ./misc/$$i.def && cp ./misc/$$i.def ./misc/$$i.ref; \
182 -rm -f $(DLLS) $(LIBS)
185 -rm -f $(addprefix ./misc/, $(addsuffix .def, $(LIBRARIES)))
188 # This is a simplified version of misc/Makefile
191 TICDIR = $(INSTALL_PREFIX)$(datadir)/terminfo
192 TABSETDIR = $(INSTALL_PREFIX)$(datadir)/tabset
198 install.emxdata :: $(TICDIR)
200 echo Building terminfo database, please wait...
201 set TERMINFO=$(TICDIR); ./progs/tic ./misc/emx.src
202 echo Installing the terminfo cleaner and the sources...
203 cp ./misc/emx.src ./misc/cleantic.cmd $(TICDIR)
204 ./misc/cleantic.cmd $(TICDIR)
208 -cd $(TICDIR) && rm -rf *
209 -cd $(TABSETDIR) && rm -rf *
212 # This is for preparing binary distributions
215 OS2NAME=ncurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-emx
218 # FIXME: this assumes that we can rerun the configure script, changing only
219 # the install-prefix. That means we cannot provide "interesting" options
223 $(MAKE) -f Makefile.os2 os2clean
224 ./configure --without-debug --with-install-prefix=`pwd|sed -e 's@^.:@@'`/$(OS2NAME)
225 $(MAKE) -f Makefile.os2 $(CF_MFLAGS) install.os2
226 -rm -f $(OS2NAME).zip
227 echo NCurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-$(NCURSES_PATCH) for emx > $(OS2NAME)/FILE_ID.DIZ
228 echo Binary release. >> $(OS2NAME)/FILE_ID.DIZ
229 zip -r $(OS2NAME).zip ./$(OS2NAME)
234 -rm -f $(OS2NAME).zip