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 $ 5# 6# Author: Juan Jose Garcia Ripoll <worm@arrakis.es>. 7# Webpage: http://www.arrakis.es/~worm/ 8################################################################################ 9# 10# Notes (from I Zakharevich) 11# ~~~~~~~~~~~~~~~~~~~~~~~~~~ 12# I could build the library with the following sequence of commands: 13# 14# touch Makefile 15# make -f Makefile.os2 config 16# make -f Makefile.os2 CC=gcc HOSTCC=gcc 17# make -f Makefile.os2 CC=gcc HOSTCC=gcc 18# 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' 24# 25# You may need to run 26# 27# rm make.defs 28# make -f Makefile.os2 make.defs 29# 30# if the build of misc/panel.def fails. 31# 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 35# 36# make -f Makefile.os2 make.dlls 37# 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. 46# 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 50# so. 51# 52# [installation] 53# 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. 57# 58# [distribution] 59# 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'. 62# 63################################################################################ 64 65all :: config 66 67# This is for configuring 68 69# What is a useful value for this? 70CONFIG_OPTS = --enable-termcap 71WWWGET = lynx -source 72MV_F = mv -f 73DLL_LN_OPTS = -Zcrtdll -Zdll -Zomf -Zmt 74 75config: config.cache 76 77config.cache: configure.cmd configure 78 -$(MV_F) $@ $@.ref 79 configure.cmd $(CONFIG_OPTS) 80 81configure.cmd: configure convert_configure.pl 82 perl convert_configure.pl configure > $@ 83 84convert_configure.pl: 85 $(WWWGET) ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2/$@ > $@ 86 87install :: 88 echo *** 89 echo *** Do not use this command. Use install.os2 instead. 90 echo *** 91 exit 2 92 93install.os2 : install.emxdata install.libs install.progs 94 95include ./Makefile 96 97all :: make.dlls 98 99# 100# DLLs and that stuff 101# 102 103LIBRARIES = ncurses form menu panel 104 105DLL_TAG = $(NCURSES_MAJOR) 106LIB_TAG = _s 107 108DLL_ROOTS = $(addsuffix $(DLL_TAG), $(LIBRARIES)) 109DLLS = $(addsuffix .dll, $(addprefix ./lib/, $(DLL_ROOTS))) 110 111LIB_ROOTS = $(addsuffix $(LIB_TAG), $(LIBRARIES)) 112LIBS = $(addsuffix .lib, $(addprefix ./lib/, $(LIB_ROOTS))) 113 114LIBS_AOUT = $(addsuffix .a, $(addprefix ./lib/, $(LIB_ROOTS))) 115 116DEFS = $(addsuffix .def, $(addprefix ./misc/, $(LIBRARIES))) 117 118DLL_SIGNATURE = NCurses-$(NCURSES_MAJOR)-$(NCURSES_MINOR)-$(NCURSES_PATCH) 119 120./lib/%$(LIB_TAG).lib : ./misc/%.def 121 emximp -o $@ $< 122 123./lib/%$(LIB_TAG).a : ./misc/%.def 124 emximp -o $@ $< 125 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 $@; \ 131 else \ 132 gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \ 133 ./lib/ncurses$(LIB_TAG).lib ./misc/$*.def -o $@; \ 134 fi 135 -rm -f ./lib/$*$(DLL_TAG).lib 136 137make.dlls : $(DEFS) $(LIBS) $(DLLS) $(LIBS_AOUT) 138 139$(DEFS) : make.defs 140 141LIBDIR = $(INSTALL_PREFIX)$(libdir) 142$(LIBDIR) : 143 mkdir -p $@ 144 145install.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 152 153uninstall.libs :: 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 160 161make.defs : 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") \ 171 || exit 1; \ 172 done 173 touch make.defs 174 175save.defs : 176 for i in $(LIBRARIES); do \ 177 test -f ./misc/$$i.def && cp ./misc/$$i.def ./misc/$$i.ref; \ 178 done 179 180clean \ 181os2clean :: 182 -rm -f $(DLLS) $(LIBS) 183 184realclean :: 185 -rm -f $(addprefix ./misc/, $(addsuffix .def, $(LIBRARIES))) 186 187# 188# This is a simplified version of misc/Makefile 189# 190 191TICDIR = $(INSTALL_PREFIX)$(datadir)/terminfo 192TABSETDIR = $(INSTALL_PREFIX)$(datadir)/tabset 193 194$(TICDIR) : 195 mkdir -p $@ 196 197install \ 198install.emxdata :: $(TICDIR) 199 -@rm -fr $(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) 205 206uninstall \ 207uninstall.emxdata :: 208 -cd $(TICDIR) && rm -rf * 209 -cd $(TABSETDIR) && rm -rf * 210 211# 212# This is for preparing binary distributions 213# 214 215OS2NAME=ncurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-emx 216 217# 218# FIXME: this assumes that we can rerun the configure script, changing only 219# the install-prefix. That means we cannot provide "interesting" options 220# when building. 221# 222os2dist : 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) 230 231clean \ 232os2clean :: 233 -rm -rf $(OS2NAME) 234 -rm -f $(OS2NAME).zip 235 236