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