Imakefile revision 0bd37d32
1XCOMM $XTermId: Imakefile,v 1.107 2013/01/01 12:16:40 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 OSMAJORVERSION = OSMajorVersion 130 OSMINORVERSION = OSMinorVersion 131 132#if defined(NTOArchitecture) || \ 133 defined(OpenBSDArchitecture) || \ 134 defined(SGIArchitecture) || \ 135 defined(SunArchitecture) 136TERMCAPDEFINES=-DUSE_TERMINFO -DHAVE_TIGETSTR 137#elif defined(LinuxArchitecture) 138# if LinuxUsesNcurses 139TERMCAPDEFINES=-DUSE_TERMINFO -DHAVE_TIGETSTR 140# endif 141#endif 142 143#if !defined(OS2Architecture) && !defined(__GNU__) 144#if defined(UseUtempter) 145 UTMPDEF = -DUSE_UTEMPTER 146#else 147 UTMPDEF = -DUTMP 148#endif 149#endif 150 151#ifdef UTF8support 152 UTF8_OPTION = -DOPT_WIDE_CHARS -DOPT_LUIT_PROG 153 UTF8SRC = charclass.c precompose.c wcwidth.c xutf8.c 154 UTF8OBJ = charclass.o precompose.o wcwidth.o xutf8.o 155#endif 156#if BuildXftLibrary 157#define XRenderSupport 158#endif 159#ifdef XRenderSupport 160 XRFDEF = -DXRENDERFONT -DXFREE86_FT2 161 XRFLIBS = XftClientLibs 162 XRFDEPLIBS = XftClientDepLibs 163 XRFINCLUDES = $(XFTINCLUDES) 164#endif 165#if !HasPutenv 166 PUTENVDEF = -DNOPUTENV 167#endif 168#ifdef TraceXTerm 169 TRACEDEF = -DOPT_TRACE=1 170#endif 171 MAIN_DEFINES = $(UTMPDEF) $(TTYGROUPDEF) $(PUCCPTYDDEF) $(CSGIDFLAGS) \ 172 -DOSMAJORVERSION=$(OSMAJORVERSION) \ 173 -DOSMINORVERSION=$(OSMINORVERSION) 174 MISC_DEFINES = /* -DALLOWLOGGING -DALLOWLOGFILEEXEC */ 175 XKB_DEFINES = XkbClientDefines 176 PATH_DEFINES = -DPROJECTROOT=$(PROJECTROOT) 177 DEFINES = $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) $(SCROLLBAR_RIGHT) $(UTF8_OPTION) $(XRFDEF) $(PATH_DEFINES) $(PUTENVDEF) $(IMAKEDEFINES) $(TRACEDEF) 178 INCLUDES = -I. $(XRFINCLUDES) 179 180 MAINSRC = main.c 181 MAINOBJ = main.o 182#ifdef TraceXTerm 183 TRACESRC = trace.c 184 TRACEOBJ = trace.o 185#endif 186 SRCS1 = button.c cachedGCs.c charproc.c charsets.c cursor.c \ 187 data.c doublechr.c fontutils.c input.c \ 188 linedata.c menu.c misc.c print.c ptydata.c scrollback.c \ 189 screen.c scrollbar.c tabs.c util.c version.c xstrings.c \ 190 xtermcap.c TekPrsTbl.c Tekproc.c VTPrsTbl.c \ 191 $(MAINSRC) $(EXTRASRC) $(UTF8SRC) $(TRACESRC) 192 OBJS1 = button.o cachedGCs.o charproc.o charsets.o cursor.o \ 193 data.o doublechr.o fontutils.o input.o \ 194 linedata.o menu.o misc.o print.o ptydata.o scrollback.o \ 195 screen.o scrollbar.o tabs.o util.o version.o xstrings.o \ 196 xtermcap.o TekPrsTbl.o Tekproc.o VTPrsTbl.o \ 197 $(MAINOBJ) $(EXTRAOBJ) $(UTF8OBJ) $(TRACEOBJ) 198 SRCS2 = resize.c version.c xstrings.c 199 OBJS2 = resize.o version.o xstrings.o 200 SRCS = $(SRCS1) $(SRCS2) 201 OBJS = $(OBJS1) $(OBJS2) 202 PROGRAMS = ProgramTargetName(resize) ProgramTargetName(xterm) 203 DEPLIBS1 = XkbClientDepLibs XawClientDepLibs $(XRFDEPLIBS) 204 DEPLIBS2 = 205 206#ifndef TermcapLibrary 207#if SystemV && !defined(MacIIArchitecture) 208#if defined(CrayArchitecture) || \ 209 (defined(HPArchitecture) && (OSMajorVersion < 10)) || \ 210 defined(RsArchitecture) || \ 211 defined(SCOArchitecture) || \ 212 defined(USLArchitecture) 213#define TermcapLibrary -lcurses /* special cases of System V */ 214#else 215#define TermcapLibrary -ltermlib /* usually in here */ 216#endif 217#else 218#define TermcapLibrary -ltermcap /* bsd puts it here */ 219#endif 220#endif 221 222 TERMCAPLIB = TermcapLibrary 223 224AllTarget($(PROGRAMS)) 225 226SpecialCObjectRule(main,$(_NOOP_),$(MAIN_DEFINES)) 227SpecialCObjectRule(menu,$(_NOOP_),$(MISC_DEFINES)) 228SpecialCObjectRule(misc,$(_NOOP_),$(MISC_DEFINES)) 229SpecialCObjectRule(charproc,$(_NOOP_),$(MISC_DEFINES)) 230SpecialCObjectRule(data,$(_NOOP_),$(MISC_DEFINES)) 231 232#if InstallXtermSetUID 233SetUIDProgramTarget(xterm,$(OBJS1),$(DEPLIBS1),$(XRFLIBS) XkbClientLibs XawClientLibs,$(TERMCAPLIB) $(PTYLIB)) 234#else 235NormalProgramTarget(xterm,$(OBJS1),$(DEPLIBS1),$(XRFLIBS) XkbClientLibs XawClientLibs,$(TERMCAPLIB) $(UTMPLIB) $(PTYLIB)) 236#endif 237 238#if defined(OpenBSDArchitecture) || defined(MirBSDArchitecture) 239/* On OpenBSD xterm is now setgid utmp */ 240INSTUIDFLAGS= -m 2555 -g utmp 241#endif 242 243#if InstallXtermSetUID && defined(SunArchitecture) && HasSharedLibraries && (OSMajorVersion < 5) 244#if AlternateUsrLibDir 245#if ((OSMajorVersion == 4) && (OSMinorVersion >= 1)) 246LDOVERRIDE = -L$(DESTDIR)$(USRLIBDIR) 247#else 248#if HasGcc 249LDOVERRIDE = -static -L$(DESTDIR)$(USRLIBDIR) 250#else 251LDOVERRIDE = -Bstatic -L$(DESTDIR)$(USRLIBDIR) 252LDRESUME = -Bdynamic 253#endif 254#endif 255#endif 256install:: 257 MakeDir($(DESTDIR)$(BINDIR)) 258 RemoveFile(ProgramTargetName(xterm.inst)) 259 LinkRule(ProgramTargetName(xterm.inst),$(CDEBUGFLAGS) $(CCOPTIONS) 260 $(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS),$(OBJS1),$(LDOVERRIDE) 261 $(XRFLIBS) XawClientLibs $(LDRESUME) $(LDLIBS) $(TERMCAPLIB) 262 $(PTYLIB)) 263 $(INSTALL) -c $(INSTPGMFLAGS) $(INSTSETIDFLAGS) ProgramTargetName(xterm.inst) $(DESTDIR)$(BINDIR)/ProgramTargetName(xterm) 264 RemoveFile(ProgramTargetName(xterm.inst)) 265#else 266InstallProgramWithFlags(xterm,$(BINDIR),$(INSTSETIDFLAGS)) 267#endif 268 269InstallNamedProg(uxterm,uxterm,$(BINDIR)) 270 271/* 272 * Link with the termcap library if USE_TERMCAP is defined in resize.c 273 */ 274#if defined(NTOArchitecture) || \ 275 defined(LinuxArchitecture) || \ 276 defined(OpenBSDArchitecture) || \ 277 defined(SGIArchitecture) || \ 278 defined(SunArchitecture) 279NormalProgramTarget(resize,$(OBJS2),$(DEPLIBS2),NullParameter,NullParameter) 280#else 281NormalProgramTarget(resize,$(OBJS2),$(DEPLIBS2),NullParameter,$(TERMCAPLIB)) 282#endif 283 284InstallProgramWithFlags(resize,$(BINDIR),NullParameter) 285 286/* 287 * termcap is a special name that does not install correctly with 288 * InstallNamedNonExec() 289 */ 290install:: 291 MakeDir($(DESTDIR)$(LIBDIR)/etc) 292 $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) termcap \ 293 $(DESTDIR)$(LIBDIR)/etc/xterm.termcap 294InstallNamedNonExec(terminfo,xterm.terminfo,$(LIBDIR)/etc) 295 296InstallAppDefaults(XTerm) 297InstallAppDefaults(UXTerm) 298InstallAppDefaultsLong(XTerm-col,XTerm-color) 299InstallManPage(xterm,$(MANDIR)) 300InstallManPage(resize,$(MANDIR)) 301DependTarget() 302