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