1#############################################################################
2# mined text editor makefile	- Mac OS X
3
4
5#############################################################################
6# Where and how to install
7# installation root, usually empty
8root	= $(INSTALLROOT)
9
10# configuration of installation directories:
11# * [l]rundir refers to the "Mined runtime support library" -
12#   it contains the online help file, auxiliary scripts (some of which
13#   might actually be installed in .../bin, too), configuration samples etc.
14# * [l]docdir is optional and refers to the mined web documentation
15#   (a copy of the mined home page).
16
17# directories for target "make install"
18prefix	= $(root)/usr
19bindir	= $(prefix)/bin
20mandir	= $(prefix)/share/man
21rundir	= $(prefix)/share/mined
22
23# directories for target "make localinstall", for use by Fink package
24lprefix	= $(root)/sw
25lbindir	= $(lprefix)/bin
26lmandir	= $(lprefix)/share/man
27lrundir	= $(lprefix)/share/mined
28
29#INSTALL = install --mode=+r,u+w
30INSTALL = install -m 644
31INSTALLBIN = install
32#INSTALL = /bin/cp -p
33#INSTALLBIN = /bin/cp -p
34
35
36#############################################################################
37# system environment adaption
38
39# select library directory
40LIBDIR	= /usr/lib${LIB}
41
42# find library with termcap API
43# prefer static linking (with ".a") rather than dynamic linking (".dylib")
44# this may yield a more portable program in a heterogeneous network
45liblist	= \
46	ls $(LIBDIR)/libtermcap.a; \
47	ls $(LIBDIR)/libncurses.a; \
48	ls $(LIBDIR)/libtermcap.dylib; \
49	ls $(LIBDIR)/libncursesw.dylib; \
50	ls $(LIBDIR)/libncurses.dylib; \
51
52
53# select first library found from list, replace with -l... if static
54firstlib = sed -e "s,\($(LIBDIR).*\)/lib\([^/]*\)\.a,-L\1 -l\2," -e "1 p" -e d
55termcap = $(shell ( $(liblist) ) 2> /dev/null | $(firstlib) )
56
57# libtest: target at bottom (must not be first target)
58
59
60#############################################################################
61# compilation target options
62
63# terminal handling mode 1: termio
64SCREEN	= -DTERMIO
65# link termcap functions:
66#SLIB	= -ltermcap	# usual termcap library
67#SLIB	= -L/usr/lib/termcap -ltermcap	# if deprecated (Linux)
68#SLIB	= -lcurses	# may work on System V Unix too (Solaris)
69# newer Linux includes the termcap API in the ncurses library:
70#SLIB	= -lncurses
71SLIB	= $(termcap)
72
73# terminal handling mode 2: sgtty (old, BSD)
74#SCREEN	= -DSGTTY
75#SLIB	= -ltermcap
76# the following was reported to compile better on some BSD system:
77#SLIB	= -L/usr/local/lib -lncurses	# includes termcap library
78
79# terminal handling mode 3: curses
80# Choose curses only if other options don't work
81# (see COMPILE.DOC for discussion).
82# Use target "make minced" to use UTF-8 enabled ncurses (>= 5.4),
83# or see separate makefile.curses for options with legacy curses.
84
85
86# select operating system flavour (define sysV if on System V flavour)
87#SYSTEM	= -Dunix -DsysV
88#SYSTEM	= -Dunix -DsysV -DFDSET
89SYSTEM	= -Dunix
90
91# select operating system environment
92DEFS	= -Dunix -D__USE_BSD
93
94
95# collection of system parameters for compilation
96SYSFLAGS	= $(SCREEN) $(SYSTEM) $(DEFS)
97
98
99#############################################################################
100# link options
101
102# link dynamically
103LDOPTS=-d y	# -dn or -Bstatic links statically
104GLDOPTS=	# -[B]static links statically
105
106
107#############################################################################
108# compiler selection and compiler-specific options
109# (source warnings, optimisation and debug)
110
111CC=gcc
112include mkinclud.gcc	# facilitate make CC=clang (new diguised default anyway...)
113
114
115#############################################################################
116# make actions
117
118KEYMAPSDEP=keymaps.t
119
120include mkinclud.mak
121
122
123#############################################################################
124# test targets
125
126libtest:
127	echo LIBDIRS checked: $(ROOTLIBDIR) $(USRLIBDIR)
128	echo ---------- liblist:
129	( $(liblist) ) || true
130	echo ---------- firstlib:
131	echo $(termcap)
132
133
134#############################################################################
135# end
136