10e3d5408SPeter Wemm################################################################################ 20e3d5408SPeter Wemm# Wrapper Makefile for ncurses library under OS/2. 30e3d5408SPeter Wemm################################################################################ 418259542SPeter Wemm# $Id: Makefile.os2,v 1.10 2000/10/09 23:53:57 Ilya.Zakharevich Exp $ 50e3d5408SPeter Wemm# 60e3d5408SPeter Wemm# Author: Juan Jose Garcia Ripoll <worm@arrakis.es>. 70e3d5408SPeter Wemm# Webpage: http://www.arrakis.es/~worm/ 80e3d5408SPeter Wemm################################################################################ 90e3d5408SPeter Wemm# 100e3d5408SPeter Wemm# Notes (from I Zakharevich) 110e3d5408SPeter Wemm# ~~~~~~~~~~~~~~~~~~~~~~~~~~ 120e3d5408SPeter Wemm# I could build the library with the following sequence of commands: 130e3d5408SPeter Wemm# 140e3d5408SPeter Wemm# touch Makefile 150e3d5408SPeter Wemm# make -f Makefile.os2 config 1618259542SPeter Wemm# make -f Makefile.os2 CC=gcc HOSTCC=gcc CXX=gcc 170e3d5408SPeter Wemm# 180e3d5408SPeter Wemm# Ignoring the following errors: 190e3d5408SPeter Wemm# Invalid configuration `os2'... 200e3d5408SPeter Wemm# ... ac_maketemp="make": not found 210e3d5408SPeter Wemm# ... syntax error: `done' unexpected 220e3d5408SPeter Wemm# No rule to make target `lib/ncurses4.dll' 230e3d5408SPeter Wemm# 240e3d5408SPeter Wemm# You may need to run 250e3d5408SPeter Wemm# 260e3d5408SPeter Wemm# rm make.defs 270e3d5408SPeter Wemm# make -f Makefile.os2 make.defs 280e3d5408SPeter Wemm# 290e3d5408SPeter Wemm# if the build of misc/panel.def fails. 300e3d5408SPeter Wemm# 310e3d5408SPeter Wemm# If you do not have perl, the configuration will fail. Use autoconf to 320e3d5408SPeter Wemm# generate the EMX-specific configure script (see README.emx), and run the 330e3d5408SPeter Wemm# configure script to generate the makefiles. Then, run 340e3d5408SPeter Wemm# 350e3d5408SPeter Wemm# make -f Makefile.os2 make.dlls 360e3d5408SPeter Wemm# 370e3d5408SPeter Wemm# Notes (from J J G Ripoll) 380e3d5408SPeter Wemm# ~~~~~~~~~~~~~~~~~~~~~~~~~ 390e3d5408SPeter Wemm# The `make.defs' rule creates the new '.def' files and outputs a diagnostic 400e3d5408SPeter Wemm# about symbols that disappear from one release to the other, as well as 410e3d5408SPeter Wemm# checks about the new '.def' consistency. If there were no problems, the 420e3d5408SPeter Wemm# maintainer is free to replace the `.ref' files with the newer ones using the 430e3d5408SPeter Wemm# `save.defs' rule. So, the only tough work is ensuring that the symbols that 440e3d5408SPeter Wemm# disappear are not essential. 450e3d5408SPeter Wemm# 460e3d5408SPeter Wemm# I first thought about killing '_nc_*' symbols, but it seems that some of 470e3d5408SPeter Wemm# them --_nc_panel_hook, _nc_ada*, etc-- are needed outside ncurses.dll. 480e3d5408SPeter Wemm# However, the whole size of the export table will not be larger than 1k or 490e3d5408SPeter Wemm# so. 500e3d5408SPeter Wemm# 510e3d5408SPeter Wemm# [installation] 520e3d5408SPeter Wemm# 530e3d5408SPeter Wemm# The way things are handled in misc/Makefile is not well suited for OS/2, 540e3d5408SPeter Wemm# where only emx.src is needed. Thus, I've written a few wrapper rules in 550e3d5408SPeter Wemm# Makefile.os2 that handle installation/deinstallation. 560e3d5408SPeter Wemm# 570e3d5408SPeter Wemm# [distribution] 580e3d5408SPeter Wemm# 590e3d5408SPeter Wemm# There's also a new rule that configures and builds a sort of binary 600e3d5408SPeter Wemm# distribution, much like the one I prepared for 1.9.9e. It's `os2dist'. 610e3d5408SPeter Wemm# 620e3d5408SPeter Wemm################################################################################ 630e3d5408SPeter Wemm 640e3d5408SPeter Wemmall :: config 650e3d5408SPeter Wemm 660e3d5408SPeter Wemm# This is for configuring 670e3d5408SPeter Wemm 680e3d5408SPeter Wemm# What is a useful value for this? 690e3d5408SPeter WemmCONFIG_OPTS = --enable-termcap 700e3d5408SPeter WemmWWWGET = lynx -source 710e3d5408SPeter WemmMV_F = mv -f 720e3d5408SPeter WemmDLL_LN_OPTS = -Zcrtdll -Zdll -Zomf -Zmt 730e3d5408SPeter Wemm 740e3d5408SPeter Wemmconfig: config.cache 750e3d5408SPeter Wemm 760e3d5408SPeter Wemmconfig.cache: configure.cmd configure 770e3d5408SPeter Wemm -$(MV_F) $@ $@.ref 780e3d5408SPeter Wemm configure.cmd $(CONFIG_OPTS) 790e3d5408SPeter Wemm 800e3d5408SPeter Wemmconfigure.cmd: configure convert_configure.pl 810e3d5408SPeter Wemm perl convert_configure.pl configure > $@ 820e3d5408SPeter Wemm 830e3d5408SPeter Wemmconvert_configure.pl: 840e3d5408SPeter Wemm $(WWWGET) ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2/$@ > $@ 850e3d5408SPeter Wemm 860e3d5408SPeter Wemminstall :: 870e3d5408SPeter Wemm echo *** 880e3d5408SPeter Wemm echo *** Do not use this command. Use install.os2 instead. 890e3d5408SPeter Wemm echo *** 900e3d5408SPeter Wemm exit 2 910e3d5408SPeter Wemm 920e3d5408SPeter Wemminstall.os2 : install.emxdata install.libs install.progs 930e3d5408SPeter Wemm 940e3d5408SPeter Wemminclude ./Makefile 950e3d5408SPeter Wemm 960e3d5408SPeter Wemmall :: make.dlls 970e3d5408SPeter Wemm 980e3d5408SPeter Wemm# 990e3d5408SPeter Wemm# DLLs and that stuff 1000e3d5408SPeter Wemm# 1010e3d5408SPeter Wemm 1020e3d5408SPeter WemmLIBRARIES = ncurses form menu panel 1030e3d5408SPeter Wemm 1040e3d5408SPeter WemmDLL_TAG = $(NCURSES_MAJOR) 1050e3d5408SPeter WemmLIB_TAG = _s 1060e3d5408SPeter Wemm 1070e3d5408SPeter WemmDLL_ROOTS = $(addsuffix $(DLL_TAG), $(LIBRARIES)) 1080e3d5408SPeter WemmDLLS = $(addsuffix .dll, $(addprefix ./lib/, $(DLL_ROOTS))) 1090e3d5408SPeter Wemm 1100e3d5408SPeter WemmLIB_ROOTS = $(addsuffix $(LIB_TAG), $(LIBRARIES)) 1110e3d5408SPeter WemmLIBS = $(addsuffix .lib, $(addprefix ./lib/, $(LIB_ROOTS))) 1120e3d5408SPeter Wemm 1130e3d5408SPeter WemmLIBS_AOUT = $(addsuffix .a, $(addprefix ./lib/, $(LIB_ROOTS))) 1140e3d5408SPeter Wemm 1150e3d5408SPeter WemmDEFS = $(addsuffix .def, $(addprefix ./misc/, $(LIBRARIES))) 1160e3d5408SPeter Wemm 1170e3d5408SPeter WemmDLL_SIGNATURE = NCurses-$(NCURSES_MAJOR)-$(NCURSES_MINOR)-$(NCURSES_PATCH) 1180e3d5408SPeter Wemm 1190e3d5408SPeter Wemm./lib/%$(LIB_TAG).lib : ./misc/%.def 1200e3d5408SPeter Wemm emximp -o $@ $< 1210e3d5408SPeter Wemm 1220e3d5408SPeter Wemm./lib/%$(LIB_TAG).a : ./misc/%.def 1230e3d5408SPeter Wemm emximp -o $@ $< 1240e3d5408SPeter Wemm 1250e3d5408SPeter Wemm./lib/%$(DLL_TAG).dll : ./lib/%.a 1260e3d5408SPeter Wemm emxomf -o ./lib/$*$(DLL_TAG).lib $< 1270e3d5408SPeter Wemm if [ "$*" = "ncurses" ]; then \ 1280e3d5408SPeter Wemm gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \ 1290e3d5408SPeter Wemm ./misc/$*.def -o $@; \ 1300e3d5408SPeter Wemm else \ 1310e3d5408SPeter Wemm gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \ 1320e3d5408SPeter Wemm ./lib/ncurses$(LIB_TAG).lib ./misc/$*.def -o $@; \ 1330e3d5408SPeter Wemm fi 1340e3d5408SPeter Wemm -rm -f ./lib/$*$(DLL_TAG).lib 1350e3d5408SPeter Wemm 1360e3d5408SPeter Wemmmake.dlls : $(DEFS) $(LIBS) $(DLLS) $(LIBS_AOUT) 1370e3d5408SPeter Wemm 1380e3d5408SPeter Wemm$(DEFS) : make.defs 1390e3d5408SPeter Wemm 14018259542SPeter WemmLIBDIR = $(DESTDIR)$(libdir) 1410e3d5408SPeter Wemm$(LIBDIR) : 1420e3d5408SPeter Wemm mkdir -p $@ 1430e3d5408SPeter Wemm 1440e3d5408SPeter Wemminstall.libs :: $(LIBS) $(DLLS) $(LIBDIR) 1450e3d5408SPeter Wemm @for i in $(DLL_ROOTS); do \ 1460e3d5408SPeter Wemm echo installing ./lib/$$i.dll as $(LIBDIR)/$$i.dll; \ 1470e3d5408SPeter Wemm $(INSTALL_DATA) ./lib/$$i.dll $(LIBDIR)/$$i.dll; done 1480e3d5408SPeter Wemm @for i in $(LIB_ROOTS); do \ 1490e3d5408SPeter Wemm echo installing ./lib/$$i.lib as $(LIBDIR)/$$i.lib; \ 1500e3d5408SPeter Wemm $(INSTALL_DATA) ./lib/$$i.lib $(LIBDIR)/$$i.lib; done 1510e3d5408SPeter Wemm 1520e3d5408SPeter Wemmuninstall.libs :: 1530e3d5408SPeter Wemm -@for i in $(DLL_ROOTS); do \ 1540e3d5408SPeter Wemm echo uninstalling $(LIBDIR)/$$i.dll; \ 1550e3d5408SPeter Wemm rm -f $(LIBDIR)/$$i.dll; done 1560e3d5408SPeter Wemm -@for i in $(LIB_ROOTS); do \ 1570e3d5408SPeter Wemm echo uninstalling $(LIBDIR)/$$i.lib; \ 1580e3d5408SPeter Wemm rm -f $(LIBDIR)/$$i.lib; done 1590e3d5408SPeter Wemm 1600e3d5408SPeter Wemmmake.defs : 1610e3d5408SPeter Wemm for i in $(LIBRARIES); do \ 1620e3d5408SPeter Wemm echo LIBRARY $${i}$(DLL_TAG) INITINSTANCE TERMINSTANCE > ./misc/$$i.def; \ 1630e3d5408SPeter Wemm echo DESCRIPTION \"$(DLL_SIGNATURE), module $$i\" >> ./misc/$$i.def; \ 1640e3d5408SPeter Wemm echo CODE LOADONCALL >> ./misc/$$i.def; \ 1650e3d5408SPeter Wemm echo DATA LOADONCALL NONSHARED MULTIPLE >> ./misc/$$i.def; \ 1660e3d5408SPeter Wemm echo EXPORTS >> ./misc/$$i.def; \ 1670e3d5408SPeter Wemm echo Creating $$i.def; \ 1680e3d5408SPeter Wemm (cmd /C ".\\misc\\makedef.cmd ./lib/$$i.a ./misc/$$i.ref >> ./misc/$$i.def" \ 1690e3d5408SPeter Wemm && cmd /C ".\\misc\\chkdef.cmd ./misc/$$i.def") \ 1700e3d5408SPeter Wemm || exit 1; \ 1710e3d5408SPeter Wemm done 1720e3d5408SPeter Wemm touch make.defs 1730e3d5408SPeter Wemm 1740e3d5408SPeter Wemmsave.defs : 1750e3d5408SPeter Wemm for i in $(LIBRARIES); do \ 1760e3d5408SPeter Wemm test -f ./misc/$$i.def && cp ./misc/$$i.def ./misc/$$i.ref; \ 1770e3d5408SPeter Wemm done 1780e3d5408SPeter Wemm 1790e3d5408SPeter Wemmclean \ 1800e3d5408SPeter Wemmos2clean :: 1810e3d5408SPeter Wemm -rm -f $(DLLS) $(LIBS) 1820e3d5408SPeter Wemm 1830e3d5408SPeter Wemmrealclean :: 1840e3d5408SPeter Wemm -rm -f $(addprefix ./misc/, $(addsuffix .def, $(LIBRARIES))) 1850e3d5408SPeter Wemm 1860e3d5408SPeter Wemm# 1870e3d5408SPeter Wemm# This is a simplified version of misc/Makefile 1880e3d5408SPeter Wemm# 1890e3d5408SPeter Wemm 19018259542SPeter WemmTICDIR = $(DESTDIR)$(datadir)/terminfo 19118259542SPeter WemmTABSETDIR = $(DESTDIR)$(datadir)/tabset 1920e3d5408SPeter Wemm 1930e3d5408SPeter Wemm$(TICDIR) : 1940e3d5408SPeter Wemm mkdir -p $@ 1950e3d5408SPeter Wemm 1960e3d5408SPeter Wemminstall \ 1970e3d5408SPeter Wemminstall.emxdata :: $(TICDIR) 1980e3d5408SPeter Wemm -@rm -fr $(TICDIR)/* 1990e3d5408SPeter Wemm echo Building terminfo database, please wait... 2000e3d5408SPeter Wemm set TERMINFO=$(TICDIR); ./progs/tic ./misc/emx.src 2010e3d5408SPeter Wemm echo Installing the terminfo cleaner and the sources... 2020e3d5408SPeter Wemm cp ./misc/emx.src ./misc/cleantic.cmd $(TICDIR) 2030e3d5408SPeter Wemm ./misc/cleantic.cmd $(TICDIR) 2040e3d5408SPeter Wemm 2050e3d5408SPeter Wemmuninstall \ 2060e3d5408SPeter Wemmuninstall.emxdata :: 2070e3d5408SPeter Wemm -cd $(TICDIR) && rm -rf * 2080e3d5408SPeter Wemm -cd $(TABSETDIR) && rm -rf * 2090e3d5408SPeter Wemm 2100e3d5408SPeter Wemm# 2110e3d5408SPeter Wemm# This is for preparing binary distributions 2120e3d5408SPeter Wemm# 2130e3d5408SPeter Wemm 2140e3d5408SPeter WemmOS2NAME=ncurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-emx 2150e3d5408SPeter Wemm 2160e3d5408SPeter Wemm# 2170e3d5408SPeter Wemm# FIXME: this assumes that we can rerun the configure script, changing only 2180e3d5408SPeter Wemm# the install-prefix. That means we cannot provide "interesting" options 2190e3d5408SPeter Wemm# when building. 2200e3d5408SPeter Wemm# 2210e3d5408SPeter Wemmos2dist : 2220e3d5408SPeter Wemm $(MAKE) -f Makefile.os2 os2clean 2230e3d5408SPeter Wemm ./configure --without-debug --with-install-prefix=`pwd|sed -e 's@^.:@@'`/$(OS2NAME) 2240e3d5408SPeter Wemm $(MAKE) -f Makefile.os2 $(CF_MFLAGS) install.os2 2250e3d5408SPeter Wemm -rm -f $(OS2NAME).zip 2260e3d5408SPeter Wemm echo NCurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-$(NCURSES_PATCH) for emx > $(OS2NAME)/FILE_ID.DIZ 2270e3d5408SPeter Wemm echo Binary release. >> $(OS2NAME)/FILE_ID.DIZ 2280e3d5408SPeter Wemm zip -r $(OS2NAME).zip ./$(OS2NAME) 2290e3d5408SPeter Wemm 2300e3d5408SPeter Wemmclean \ 2310e3d5408SPeter Wemmos2clean :: 2320e3d5408SPeter Wemm -rm -rf $(OS2NAME) 2330e3d5408SPeter Wemm -rm -f $(OS2NAME).zip 2340e3d5408SPeter Wemm 235