Imakefile revision a1f3da82
1XCOMM $XTermId: Imakefile,v 1.103 2011/02/19 13:09:15 tom Exp $
2XCOMM
3XCOMM                         Attention xterm porters
4XCOMM
5XCOMM
6XCOMM Xterm assumes that bcopy can handle overlapping arguments.  If your
7XCOMM bcopy (or memcpy) cannot, write a routine called bcopy and link it in
8XCOMM or add -Dbcopy=mybcopy to the DEFINES list below.
9XCOMM
10
11/* Uncomment SCROLLBAR_RIGHT if you want the scroll bar to be on the right */
12SCROLLBAR_RIGHT = -DSCROLLBAR_RIGHT
13
14/* Define UTF8support to compile-in support for UTF-8 */
15#define UTF8support
16
17/*
18 * setgid mode works for systems that do not require setuid to open pty.
19 *
20 * This feature could also be applied to FreeBSD, but requires the installer
21 * to define a "utmp" group as well as chgrp the utmp file to match.
22 *
23 * Note: InstallXtermSetUID is always defined; InstallXtermSetGID is defined
24 * in newer imake configurations.
25 */
26#if !defined(InstallXtermSetGID) && !InstallXtermSetUID
27#if defined(OpenBSDArchitecture) || \
28    (defined(LinuxArchitecture) && \
29     (LinuxCLibMajorVersion == 6))
30#define InstallXtermSetGID YES
31#endif
32#endif
33
34/*
35 * Override the set uid/gid flags to use the utempter library.
36 */
37#if defined(UseUtempter)
38#undef InstallXtermSetUID /* imake sets this */
39#undef InstallXtermSetGID /* we set this */
40#define InstallXtermSetUID NO
41#define InstallXtermSetGID NO
42        UTMPLIB = -lutempter
43#endif
44
45/*
46 * Fixes to allow compile with X11R5, etc.
47 */
48#ifndef InstGidFlags
49#define InstGidFlags -m 2755 -g utmp
50#endif
51
52#ifndef InstUidFlags
53#define InstUidFlags -m 4711
54#endif
55
56#ifndef XkbClientDefines
57#define XkbClientDefines /**/
58#endif
59
60#ifndef InstallXtermSetUID
61#define InstallXtermSetUID NO
62#endif
63
64#ifndef InstallXtermSetGID
65#define InstallXtermSetGID NO
66#endif
67
68#ifndef XkbClientDepLibs
69#define XkbClientDepLibs /**/
70#endif
71
72#ifndef XkbClientLibs
73#define XkbClientLibs /**/
74#endif
75
76/* This must come before setting DEFINES */
77#if InstallXtermSetGID
78CSGIDFLAGS = -DUSE_UTMP_SETGID
79INSTSETIDFLAGS = InstGidFlags
80#elif InstallXtermSetUID
81INSTSETIDFLAGS = InstUidFlags
82#else
83INSTSETIDFLAGS = NullParameter
84#endif
85
86/*
87 * Compensate for broken imake configuration.
88 */
89#ifdef LinuxGnuSourceDefines
90# ifdef UseInstalled
91   IMAKEDEFINES = -D_GNU_SOURCE
92# endif
93#endif
94
95#ifndef SpecialCObjectRule
96#define SpecialCObjectRule(module,ignore,defines) \
97module.o: ; $(CC) -c defines $(CFLAGS) module.c
98#endif
99
100#ifndef ProgramTargetName
101#define ProgramTargetName(program) program
102#endif
103
104/*
105 * add -DWTMP and -DLASTLOG if you want them; make sure that bcopy can
106 * handle overlapping copies before using it.
107 */
108#if SetTtyGroup			/* turn on in config/machine.cf */
109    TTYGROUPDEF = -DUSE_TTY_GROUP
110#endif
111#ifdef UsePUCCPtyd		/* turn on in config/site.def */
112    PUCCPTYDDEF = -DPUCC_PTYD	/* does not need to be setuid */
113         PTYLIB = -lpucc
114#endif
115
116#if defined(NetBSDArchitecture) || \
117    defined(OpenBSDArchitecture) || \
118    defined(FreeBSDArchitecture) || \
119    (defined(LinuxArchitecture) && \
120     (LinuxCLibMajorVersion == 6) && (LinuxCLibMinorVersion < 1))
121         PTYLIB = -lutil
122#endif
123
124#ifdef DarwinArchitecture
125/* dyld can deadlock if a signal comes in when it is looking up a symbol */
126  LOCAL_LDFLAGS = -Wl,-bind_at_load
127#endif
128
129#ifdef OS2Architecture
130/*
131 * Only used in os2main.c, see ptyx.h for OPT_I18N_SUPPORT
132 * <werner@suse.de>
133 */
134#if XtermWithI18N
135        I18NDEF = -DI18N
136      FEATURE_DEFINES = -DDEBUG -DALLOWLOGGING $(I18NDEF)
137#else
138      FEATURE_DEFINES = -DDEBUG -DALLOWLOGGING
139#endif
140#endif
141
142 OSMAJORVERSION = OSMajorVersion
143 OSMINORVERSION = OSMinorVersion
144
145#if	defined(NTOArchitecture)	|| \
146	defined(LinuxArchitecture)	|| \
147	defined(OpenBSDArchitecture)	|| \
148	defined(SGIArchitecture)	|| \
149	defined(SunArchitecture)
150TERMCAPDEFINES=-DUSE_TERMINFO -DHAVE_TIGETSTR
151#endif
152
153#if !defined(OS2Architecture) && !defined(__GNU__)
154#if defined(UseUtempter)
155        UTMPDEF = -DUSE_UTEMPTER
156#else
157        UTMPDEF = -DUTMP
158#endif
159#endif
160
161#ifdef UTF8support
162    UTF8_OPTION = -DOPT_WIDE_CHARS -DOPT_LUIT_PROG
163        UTF8SRC = charclass.c precompose.c wcwidth.c xutf8.c
164        UTF8OBJ = charclass.o precompose.o wcwidth.o xutf8.o
165#endif
166#if BuildXftLibrary
167#define XRenderSupport
168#endif
169#ifdef XRenderSupport
170         XRFDEF = -DXRENDERFONT -DXFREE86_FT2
171        XRFLIBS = XftClientLibs
172     XRFDEPLIBS = XftClientDepLibs
173    XRFINCLUDES = $(XFTINCLUDES)
174#endif
175#if !HasPutenv
176      PUTENVDEF = -DNOPUTENV
177#endif
178#ifdef TraceXTerm
179       TRACEDEF = -DOPT_TRACE=1
180#endif
181   MAIN_DEFINES = $(UTMPDEF) $(TTYGROUPDEF) $(PUCCPTYDDEF) $(CSGIDFLAGS) \
182		  -DOSMAJORVERSION=$(OSMAJORVERSION) \
183		  -DOSMINORVERSION=$(OSMINORVERSION)
184   MISC_DEFINES = /* -DALLOWLOGGING -DALLOWLOGFILEEXEC */
185    XKB_DEFINES = XkbClientDefines
186   PATH_DEFINES = -DPROJECTROOT=$(PROJECTROOT)
187        DEFINES = $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) $(SCROLLBAR_RIGHT) $(UTF8_OPTION) $(XRFDEF) $(PATH_DEFINES) $(PUTENVDEF) $(IMAKEDEFINES) $(TRACEDEF)
188       INCLUDES = -I. $(XRFINCLUDES)
189
190#ifdef OS2Architecture
191        MAINSRC = os2main.c
192        MAINOBJ = os2main.o
193#else
194        MAINSRC = main.c
195        MAINOBJ = main.o
196#endif
197#ifdef TraceXTerm
198       TRACESRC = trace.c
199       TRACEOBJ = trace.o
200#endif
201          SRCS1 = button.c cachedGCs.c charproc.c charsets.c cursor.c \
202		  data.c doublechr.c fontutils.c input.c \
203		  linedata.c menu.c misc.c print.c ptydata.c scrollback.c \
204		  screen.c scrollbar.c tabs.c util.c xstrings.c xtermcap.c \
205		  TekPrsTbl.c Tekproc.c VTPrsTbl.c \
206		  $(MAINSRC) $(EXTRASRC) $(UTF8SRC) $(TRACESRC)
207          OBJS1 = button.o cachedGCs.o charproc.o charsets.o cursor.o \
208		  data.o doublechr.o fontutils.o input.o \
209		  linedata.o menu.o misc.o print.o ptydata.o scrollback.o \
210		  screen.o scrollbar.o tabs.o util.o xstrings.o xtermcap.o \
211		  TekPrsTbl.o Tekproc.o VTPrsTbl.o \
212		  $(MAINOBJ) $(EXTRAOBJ) $(UTF8OBJ) $(TRACEOBJ)
213          SRCS2 = resize.c xstrings.c
214          OBJS2 = resize.o xstrings.o
215           SRCS = $(SRCS1) $(SRCS2)
216           OBJS = $(OBJS1) $(OBJS2)
217       PROGRAMS = ProgramTargetName(resize) ProgramTargetName(xterm)
218       DEPLIBS1 = XkbClientDepLibs XawClientDepLibs $(XRFDEPLIBS)
219       DEPLIBS2 =
220
221#ifndef TermcapLibrary
222#if SystemV && !defined(MacIIArchitecture)
223#if	defined(CrayArchitecture) || \
224	(defined(HPArchitecture) && (OSMajorVersion < 10)) || \
225	defined(RsArchitecture) || \
226	defined(SCOArchitecture) || \
227	defined(USLArchitecture)
228#define TermcapLibrary -lcurses		/* special cases of System V */
229#else
230#define TermcapLibrary -ltermlib	/* usually in here */
231#endif
232#else
233#define TermcapLibrary -ltermcap	/* bsd puts it here */
234#endif
235#endif
236
237     TERMCAPLIB = TermcapLibrary
238
239AllTarget($(PROGRAMS))
240
241SpecialCObjectRule(main,$(_NOOP_),$(MAIN_DEFINES))
242SpecialCObjectRule(menu,$(_NOOP_),$(MISC_DEFINES))
243SpecialCObjectRule(misc,$(_NOOP_),$(MISC_DEFINES))
244SpecialCObjectRule(charproc,$(_NOOP_),$(MISC_DEFINES))
245SpecialCObjectRule(data,$(_NOOP_),$(MISC_DEFINES))
246
247#if InstallXtermSetUID
248SetUIDProgramTarget(xterm,$(OBJS1),$(DEPLIBS1),$(XRFLIBS) XkbClientLibs XawClientLibs,$(TERMCAPLIB) $(PTYLIB))
249#else
250NormalProgramTarget(xterm,$(OBJS1),$(DEPLIBS1),$(XRFLIBS) XkbClientLibs XawClientLibs,$(TERMCAPLIB) $(UTMPLIB) $(PTYLIB))
251#endif
252
253#if InstallXtermSetUID && defined(SunArchitecture) && HasSharedLibraries && (OSMajorVersion < 5)
254#if AlternateUsrLibDir
255#if ((OSMajorVersion == 4) && (OSMinorVersion >= 1))
256LDOVERRIDE = -L$(DESTDIR)$(USRLIBDIR)
257#else
258#if HasGcc
259LDOVERRIDE = -static -L$(DESTDIR)$(USRLIBDIR)
260#else
261LDOVERRIDE = -Bstatic -L$(DESTDIR)$(USRLIBDIR)
262LDRESUME = -Bdynamic
263#endif
264#endif
265#endif
266install::
267	MakeDir($(DESTDIR)$(BINDIR))
268	RemoveFile(ProgramTargetName(xterm.inst))
269	LinkRule(ProgramTargetName(xterm.inst),$(CDEBUGFLAGS) $(CCOPTIONS)
270	$(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS),$(OBJS1),$(LDOVERRIDE)
271	$(XRFLIBS) XawClientLibs $(LDRESUME) $(LDLIBS) $(TERMCAPLIB)
272	$(PTYLIB))
273	$(INSTALL) -c $(INSTPGMFLAGS) $(INSTSETIDFLAGS) ProgramTargetName(xterm.inst) $(DESTDIR)$(BINDIR)/ProgramTargetName(xterm)
274	RemoveFile(ProgramTargetName(xterm.inst))
275#else
276InstallProgramWithFlags(xterm,$(BINDIR),$(INSTSETIDFLAGS))
277#endif
278
279InstallNamedProg(uxterm,uxterm,$(BINDIR))
280
281/*
282 * Link with the termcap library if USE_TERMCAP is defined in resize.c
283 */
284#if	defined(NTOArchitecture)	|| \
285	defined(LinuxArchitecture)	|| \
286	defined(OpenBSDArchitecture)	|| \
287	defined(SGIArchitecture)	|| \
288	defined(SunArchitecture)
289NormalProgramTarget(resize,$(OBJS2),$(DEPLIBS2),NullParameter,NullParameter)
290#else
291NormalProgramTarget(resize,$(OBJS2),$(DEPLIBS2),NullParameter,$(TERMCAPLIB))
292#endif
293
294InstallProgramWithFlags(resize,$(BINDIR),NullParameter)
295
296/*
297 * termcap is a special name that does not install correctly with
298 * InstallNamedNonExec()
299 */
300install::
301	MakeDir($(DESTDIR)$(LIBDIR)/etc)
302	$(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) termcap \
303		$(DESTDIR)$(LIBDIR)/etc/xterm.termcap
304InstallNamedNonExec(terminfo,xterm.terminfo,$(LIBDIR)/etc)
305
306InstallAppDefaults(XTerm)
307InstallAppDefaults(UXTerm)
308InstallAppDefaultsLong(XTerm-col,XTerm-color)
309InstallManPage(xterm,$(MANDIR))
310InstallManPage(resize,$(MANDIR))
311DependTarget()
312