Don't use fstat for readable pipe chars in dtexec.
[oweals/cde.git] / cde / programs / dtlogin / Imakefile
1 XCOMM $TOG: Imakefile /main/21 1999/03/01 18:26:06 mgreess $
2 #define IHaveSubdirs
3 #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
4
5 SUBDIRS = config $(XDMSUBDIRS) $(BLSSUBDIRS) $(AFSSUBDIRS)
6
7 MakeSubdirs($(SUBDIRS))
8 DependSubdirs($(SUBDIRS))
9
10 #if InstallXdmConfig 
11    XDMCONFIGDIR = XdmConfigurationSubdirectory
12      XDMSUBDIRS = $(XDMCONFIGDIR) bootxutil
13 #endif
14
15 /* please list any new dtlogin headers for use by krb and rgy */
16 HEADERS = dm.h vg.h vglogo.h vgmsg.h vgproto.h
17
18 #if HasXdmAuth
19 DESDEFS = -DHASDES -DHASXDMAUTH -DSILLYEXPORTRULE
20 DESOBJS = xdmauth.o
21 DESSRCS = xdmauth.c
22 #else
23 #if HasDESLibrary
24 DESDEFS = -DHASDES
25 DESOBJS = xdmauth.o
26 DESSRCS = xdmauth.c
27 #else
28 DESDEFS = 
29 DESOBJS =
30 DESSRCS = 
31 #endif
32 #endif
33
34 #ifndef UsePamLibrary
35 # define UsePamLibrary  NO
36 #endif
37
38 #if UsePamLibrary
39 PAM_SRCS = pam_svc.c
40 PAM_OBJS = pam_svc.o
41 PAM_LIB = -lpam
42 #else
43 PAM_SRCS =
44 PAM_OBJS =
45 PAM_LIB =
46 #endif
47
48 #ifdef SunArchitecture 
49 SOLARIS_SRCS = solaris.c
50 SOLARIS_OBJS = solaris.o
51 #else
52 SOLARIS_SRCS =
53 SOLARIS_OBJS =
54 #endif
55
56 #if defined(SunArchitecture) && !UsePamLibrary
57 PAM_LIB = -lauth
58 #endif
59
60          XDMDIR = $(CDE_LOGFILES_TOP)
61
62 /******************  DTLOGIN ARCHIVE SECTION *****************
63    A better long-term solution is a dtgreet subdirectory since dtgreet
64    is built with shared libraries.
65    dtlogin is always built archived in HP because of 
66    its importance for user startup. DEPLIBS needs to be explicitly set
67    because default is null DEPLIBS for shared libraries.
68    Does this need to be ifdef'd hp? */
69 /* Defaults */
70 LOGINDEPXMULIB = $(DEPXMULIB)
71 LOGINXMULIB = $(XMULIB)
72 LOGINDEPXLIB = $(DEPXLIB)
73 LOGINXLIB = $(XLIB)
74
75 #ifdef HPArchitecture
76 #  if (! defined(UseInstalled)) && (! defined(UseMitLibrariesFromSystemOnly))
77 #    ifdef SHLIB
78 LOGINDEPXMULIB = $(XMUSRC)/libXmu.a
79 LOGINXMULIB = $(LOGINDEPXMULIB)
80 LOGINDEPXLIB = $(XLIBSRC)/libX11.a
81 LOGINXLIB = $(LOGINDEPXLIB)
82 /* This is really a kludge !! */
83 LOGINLDOPTIONS = -Wl,-a archive
84 #    endif
85 #  endif
86 #  if OSMajorVersion >= 10
87 SYS_LIBRARIES = -lsec
88 #  endif
89 #endif
90
91 #if defined(SunArchitecture)
92 /* note: libcmd.a is a Sun static private lib for login related work. 
93  *       It should come before $(PAM_LIB) in link line, at least when compiled
94  *       on Solaris 2.4 and run on Solaris 2.5.  In Solaris 2.4 some of 
95  *       libcmd.a functions are also in libauth.so.  But on Solaris 2.5 
96  *       these Sun private functions have been removed from libauth.so. */
97 SYS_LIBRARIES = -lm -ldl -lgen -lresolv -lC -lbsm -lcmd -lauth $(PAM_LIB)
98
99
100 #  if UsePamLibrary
101    EXTRA_DEFINES = -DPAM
102 #  else
103    EXTRA_DEFINES = -DSUNAUTH
104 #  endif
105 #endif
106
107 #if defined(USLArchitecture)
108 SYS_LIBRARIES = -lm -ldl -lgen -lresolv
109 #endif
110
111 #if defined(UXPArchitecture)
112 SYS_LIBRARIES = -lm -ldl -lgen -lresolv
113 #endif
114
115 #if defined(RsArchitecture)
116 SYS_LIBRARIES = -ls
117 #endif
118
119 #ifdef AlphaArchitecture
120 SYS_LIBRARIES = -lm -lXdmcp
121 #endif
122
123 #if defined(LinuxArchitecture) || defined(FreeBSDArchitecture)
124 SYS_LIBRARIES = -lm -lcrypt
125 /* just use the system provided Xau and Xdmcp*/
126 DEPXAUTHLIB = 
127 DEPXDMCPLIB = 
128 #endif
129
130 /* Add in freetype header locations, required for modern Motif libs */
131 #ifdef LinuxArchitecture
132 INCLUDES = -I/usr/include/freetype2
133 #endif
134
135 #if defined(OpenBSDArchitecture) || defined(FreeBSDArchitecture)
136 INCLUDES = -I$(XPROJECTROOT)/include/freetype2
137 #endif
138
139 /**************************************************************************
140  *
141  *  Source and object modules
142  *
143  *    SRCS1 = Dtlogin sources
144  *    OBJS1 = Dtlogin objects
145  *
146  *    SRCS2 = Dtgreet sources
147  *    OBJS2 = Dtgreet objects
148  *
149  *    SRCS3 = Dtchooser sources
150  *    OBJS3 - Dtchooser objects
151  *
152  **************************************************************************/
153
154           PROG1 = dtlogin
155
156           SRCS1 = access.c account.c auth.c genauth.c daemon.c dm.c \
157                   dpylist.c error.c file.c mitauth.c protodpy.c policy.c \
158                   reset.c resource.c server.c session.c socket.c util.c \
159                   verify.c version.c apollo.c sysauth.c fontpath.c $(DESSRCS) \
160                   qualify.c usl_ptty.c choose.c netaddr.c xdmcp.c \
161                   $(PAM_SRCS) $(SOLARIS_SRCS)
162
163           OBJS1 = access.o account.o auth.o genauth.o daemon.o dm.o \
164                   dpylist.o error.o file.o mitauth.o protodpy.o policy.o \
165                   reset.o resource.o server.o session.o socket.o util.o \
166                   verify.o version.o apollo.o sysauth.o fontpath.o $(DESOBJS) \
167                   qualify.o usl_ptty.o choose.o netaddr.o xdmcp.o \
168                   $(PAM_OBJS) $(SOLARIS_OBJS) 
169
170           PROG2 = dtgreet
171 #ifdef AlphaArchitecture
172           SRCS2 = vgcallback.c vglogo.c vgmain.c vgutil.c \
173                   vgversion.c vgapollo.c vglang.c vgsiaform.c
174           OBJS2 = vgcallback.o vglogo.o vgmain.o vgutil.o \
175                   vgversion.o vgapollo.o vglang.o vgsiaform.o
176 #else
177           SRCS2 = vgcallback.c vglogo.c vgmain.c vgutil.c \
178                   vgversion.c vgapollo.c vglang.c
179           OBJS2 = vgcallback.o vglogo.o vgmain.o vgutil.o \
180                   vgversion.o vgapollo.o vglang.o
181 #endif
182
183           PROG3 = dtchooser
184           SRCS3 = chooser.c dtchooser.c vglogo.c vgutil.c \
185                   vgcallback.c vglang.c
186           OBJS3 = chooser.o dtchooser.o vglogo.o vgutil.o \
187                   vgcallback.o vglang.o
188
189        PROGRAMS = $(PROG1) $(PROG2) $(PROG3)
190
191 /**************************************************************************
192  *
193  *  Defines
194  *
195  **************************************************************************/
196
197 #if defined (SunArchitecture)
198   NATIVEXBINDIR = /usr/openwin/bin
199 #else
200   NATIVEXBINDIR = /usr/bin/X11
201 #endif
202
203         SIGDEFS = $(SIGNAL_DEFINES)
204
205         XBINDIR = $(XPROJECTROOT)/bin
206  OSMAJORVERSION = OSMajorVersion
207  OSMINORVERSION = OSMinorVersion
208      DTDEFINES = $(DESDEFS) ConnectionFlags \
209                   -DBINDIR=\"$(XBINDIR)\" -DXDMDIR=\"$(XDMDIR)\" $(SIGDEFS) \
210                   -DOSMAJORVERSION=$(OSMAJORVERSION) \
211                   -DOSMINORVERSION=$(OSMINORVERSION) \
212                   -DCDE_INSTALLATION_TOP=\"$(CDE_INSTALLATION_TOP)\" \
213                   -DCDE_CONFIGURATION_TOP=\"$(CDE_CONFIGURATION_TOP)\"
214
215 #if defined (HPArchitecture)
216         DEFINES = $(DTDEFINES) -D_XPG2 -DAUDIT -DBYPASSLOGIN ServerExtraDefines
217 #elif defined (RsArchitecture)
218         DEFINES = $(DTDEFINES) -D_ILS_MACROS -DBSD44SOCKETS \
219                   -D__NetBSD__ -DENABLE_DYNAMIC_LANGLIST
220 #elif defined (AlphaArchitecture)
221         DEFINES = $(DTDEFINES) -DXDMCP -DSIA
222 #else
223         DEFINES = $(DTDEFINES) -D_NO_PROTO
224 #endif
225
226 XCOMM
227 XCOMM Special definitions for compiling default resources; these parameters
228 XCOMM should be set in util/imake.includes/site.def or the appropriate .macros
229 XCOMM file in that directory.  The lack of initial spaces is to prevent imake
230 XCOMM from accidently turning the lines into rules by putting a leading tab.
231 XCOMM
232 XCOMM Do NOT change these lines!
233 XCOMM
234 DEF_SERVER = $(XBINDIR)/X
235 DEF_USER_PATH = DefaultUserPath:/usr/ccs/bin:$(NATIVEXBINDIR):$(XBINDIR)
236 DEF_SYSTEM_PATH = DefaultSystemPath:$(NATIVEXBINDIR):$(XBINDIR)
237 BOURNE_SHELL = DefaultSystemShell
238 CPP_PROGRAM = CppCmd
239 DEF_BM_PATH = /etc/dt/appconfig/icons/%L/%B%M.bm:/etc/dt/appconfig/icons/%L/%B%M.pm:/etc/dt/appconfig/icons/%L/%B:/etc/dt/appconfig/icons/C/%B%M.bm:/etc/dt/appconfig/icons/C/%B%M.pm:/etc/dt/appconfig/icons/C/%B:/usr/dt/appconfig/icons/%L/%B%M.bm:/usr/dt/appconfig/icons/%L/%B%M.pm:/usr/dt/appconfig/icons/%L/%B:/usr/dt/appconfig/icons/C/%B%M.bm:/usr/dt/appconfig/icons/C/%B%M.pm:/usr/dt/appconfig/icons/C/%B
240 DEF_PM_PATH=/etc/dt/appconfig/icons/%L/%B%M.pm:/etc/dt/appconfig/icons/%L/%B%M.bm:/etc/dt/appconfig/icons/%L/%B:/etc/dt/appconfig/icons/C/%B%M.pm:/etc/dt/appconfig/icons/C/%B%M.bm:/etc/dt/appconfig/icons/C/%B:/usr/dt/appconfig/icons/%L/%B%M.pm:/usr/dt/appconfig/icons/%L/%B%M.bm:/usr/dt/appconfig/icons/%L/%B:/usr/dt/appconfig/icons/C/%B%M.pm:/usr/dt/appconfig/icons/C/%B%M.bm:/usr/dt/appconfig/icons/C/%B
241
242 RES_DEFINES = '-DDEF_SERVER_LINE=":0 Local local $(DEF_SERVER) :0"' \
243                   '-DXRDB_PROGRAM="$(XBINDIR)/xrdb"' \
244                   '-DDEF_USER_PATH="$(DEF_USER_PATH)"' \
245                   '-DDEF_SYSTEM_PATH="$(DEF_SYSTEM_PATH)"' \
246                   '-DDEF_FAILSAFE_CLIENT="$(XBINDIR)/xterm"' \
247                   '-DDEF_AUTH_FILE="$(XDMDIR)/auth-server"' \
248                   '-DDEF_AUTH_DIR="$(XDMDIR)"' \
249                   '-DCPP_PROGRAM="$(CPP_PROGRAM)"' \
250                   '-DDEF_PM_SEARCH_PATH="$(DEF_PM_PATH)"' \
251                   '-DDEF_BM_SEARCH_PATH="$(DEF_BM_PATH)"'
252
253 XCOMM
254 XCOMM These -D flags had to be taken out of the RES_DEFINES macro in order
255 XCOMM to get around a buffer limitation in the Sun C compiler code generation
256 XCOMM phase.  The code generation phase creates a temporary assembler file
257 XCOMM containing the command line to the compiler and all the .ident pragmas.
258 XCOMM With resent changes to the Imakefile, the command line had gotten so
259 XCOMM long that it exceeded an internal buffer length resulting in errors in
260 XCOMM the generated assembler code.  The EXTRA_RES_DEFINES were extracted
261 XCOMM from the RES_DEFINES macro in order to shorten the command line on
262 XCOMM the Sun platform.  These particular -D flags were chosen as the
263 XCOMM least likely to change or be system dependent.
264 XCOMM
265 #ifdef SunArchitecture 
266 EXTRA_RES_DEFINES =
267 #else
268 EXTRA_RES_DEFINES = \
269                   '-DDEF_SESSION="$(CDE_INSTALLATION_TOP)/bin/Xsession"' \
270                   '-DDEF_SYSTEM_SHELL="$(BOURNE_SHELL)"' \
271                   '-DDEF_CHOOSER="$(CDE_INSTALLATION_TOP)/bin/dtchooser"' \
272                   '-DDEF_XDM_CONFIG="Xconfig"'
273 #endif
274
275
276
277 /**************************************************************************
278  *
279  *  Libraries
280  *
281  *    BASE_LIBS1 = dtlogin base libraries
282  *    BASE_LIBS2 = dtgreet base libraries
283  *
284  **************************************************************************/
285
286
287     DEPLIBS1 = $(DEPXAUTHLIB) $(DEPXDMCPLIB) $(LOGINDEPXMULIB) $(LOGINDEPXLIB)
288     DEPLIBS2  = $(DEPDTWIDGETLIB) $(DEPDTSVCLIB) $(DEPTTLIB) $(DEPXMLIB)  \
289                 $(DEPXTOOLLIB) $(DEPXPLIB) $(DEPXLIB)
290     DEPLIBS3 = $(DEPXDMCPLIB) $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXPLIB) $(DEPXLIB)
291
292     BASE_LIBS1  = $(XAUTHLIB) $(LOGINXMULIB) $(XDMCPLIB) $(LOGINXLIB)
293     BASE_LIBS2  = $(DTWIDGETLIB) $(DTSVCLIB) $(TTLIB) $(XMLIB) \
294                   $(XTOOLLIB) $(XPLIB) $(XLIB)
295     BASE_LIBS3  = $(DTWIDGETLIB) $(DTSVCLIB) $(TTLIB) $(XDMCPLIB) $(XMLIB) \
296                   $(XTOOLLIB) $(XPLIB) $(XLIB)
297
298     LOCAL_LIBRARIES1 = $(BASE_LIBS1) $(IAFSYSLIB)
299     LOCAL_LIBRARIES2 = $(BASE_LIBS2)
300     LOCAL_LIBRARIES3 = $(BASE_LIBS3)
301
302
303 /* USL needs to resolve all Xt symbols invoked by Xmu at shared
304  * library link time.
305  * Likewise for the BMS references from libDt for vuegreet.
306  */
307 #if defined(USLArchitecture)
308 # if HasSharedLibraries
309     BASE_LIBS1  = $(XAUTHLIB) $(LOGINXMULIB) $(XDMCPLIB) $(XTOOLLIB) \
310                   $(LOGINXLIB)
311     BASE_LIBS2  = $(DTWIDGETLIB) $(DTSVCLIB) $(TTLIB) \
312                   $(XMLIB) $(XTOOLLIB) $(XPLIB) $(XLIB)
313 # endif
314 #endif
315
316 #if defined(UXPArchitecture)
317 # if HasSharedLibraries
318     BASE_LIBS1  = $(XAUTHLIB) $(LOGINXMULIB) $(XDMCPLIB) $(XTOOLLIB) \
319                   $(LOGINXLIB)
320     BASE_LIBS2  = $(DTWIDGETLIB) $(DTSVCLIB) $(TTLIB) \
321                   $(XMLIB) $(XTOOLLIB) $(XPLIB) $(XLIB)
322 # endif
323 #endif
324
325
326
327 /**************************************************************************
328  *
329  *  Extra things for the HP-UX BLS version
330  *
331  **************************************************************************/
332
333 #ifndef BLS
334 # ifdef HPArchitecture
335 #  if (OSMajorVersion == 8) && (OSMinorVersion == 8)
336 #    define BLS
337 #  endif
338 # endif
339 #endif
340
341 #ifdef BLS
342         BLSSUBDIRS = bls
343          BLSLIBSRC = ./bls
344     EXTRA_DEFINES = -UAUDIT -D_NO_PROTO
345      EXTRA_CFLAGS = -Wp,-H256000
346   EXTRA_LIBRARIES = $(BLSLIBSRC)/libbls.a -lsec ExtraLibraries
347   STD_CPP_DEFINES = -DSYSV  -DBLS
348 #endif
349
350
351
352 /**************************************************************************
353  *
354  *  Extra things for the Kerberos/AFS version (dtlogin.krb)
355  *
356  **************************************************************************/
357
358 #ifdef USE_KRB
359
360      AFSSUBDIRS = afs
361
362       KRBLIBSRC = $(LIBSRC)/krb
363       DEPKRBLIB = $(KRBLIBSRC)/libkrb.a
364          KRBLIB = $(DEPKRBLIB)
365
366       DESLIBSRC = $(LIBSRC)/des
367       DEPDESLIB = $(DESLIBSRC)/libdes.a
368          DESLIB = $(DEPDESLIB)
369
370   KRBINCLUDESRC = $(KRBLIBSRC)/include
371       AFSLIBSRC = ./afs
372   AFSINCLUDESRC = $(AFSLIBSRC)
373  EXTRA_INCLUDES = -I$(KRBINCLUDESRC) -I$(AFSINCLUDESRC)
374   EXTRA_DEFINES = -D__KERBEROS -D__AFS
375
376 LOCAL_LIBRARIES1 = $(BASE_LIBS1)  \
377                    $(KRBLIB) \
378                    $(IAFSYSLIB) \
379                    $(AFSLIBSRC)/libafsutil.a \
380                    $(AFSLIBSRC)/$(VENDOR)/$(HARDWARE)/libdes.a
381
382 LOCAL_LIBRARIES2 = $(BASE_LIBS2) \
383                    $(KRBLIB) \
384                    $(AFSLIBSRC)/$(VENDOR)/$(HARDWARE)/libkauth.a \
385                    $(AFSLIBSRC)/$(VENDOR)/$(HARDWARE)/libprot.a \
386                    $(AFSLIBSRC)/$(VENDOR)/$(HARDWARE)/libubik.a \
387                    $(AFSLIBSRC)/$(VENDOR)/$(HARDWARE)/libauth.a \
388                    $(AFSLIBSRC)/$(VENDOR)/$(HARDWARE)/librxkad.a \
389                    $(AFSLIBSRC)/$(VENDOR)/$(HARDWARE)/libsys.a \
390                    $(AFSLIBSRC)/$(VENDOR)/$(HARDWARE)/libdes.a \
391                    $(AFSLIBSRC)/$(VENDOR)/$(HARDWARE)/librx.a \
392                    $(AFSLIBSRC)/$(VENDOR)/$(HARDWARE)/liblwp.a \
393                    $(AFSLIBSRC)/$(VENDOR)/$(HARDWARE)/libcom_err.a \
394                    $(AFSLIBSRC)/libafsutil.a \
395                    -lBSD
396 #endif
397
398
399
400 /**************************************************************************
401  *
402  *  Extra things for the Passwd Etc. version (dtlogin.rgy)
403  *
404  **************************************************************************/
405
406 #ifdef USE_RGY
407      EXTRA_INCLUDES = -I$(RGYINCLUDESRC)
408       EXTRA_DEFINES = -D__PASSWD_ETC +e
409     EXTRA_LIBRARIES = $(RGYLIB) $(NCKLIB) -lndbm -lBSD ExtraLibraries
410 #endif
411
412
413
414 /**************************************************************************
415  *
416  *  Extra things for Dtge 
417  *
418  *    HIDDEN_SYMBOLS1 = dtlogin hidden symbols
419  *    HIDDEN_SYMBOLS2 = dtgreet hidden symbols
420  *
421  **************************************************************************/
422
423 #ifdef HPArchitecture
424 #  ifdef __hp9000s300
425
426       HIDDEN_SYMBOLS1 = -h _main -h _BecomeDaemon -h _GetHourGlass \
427                         -h _Verify
428       HIDDEN_SYMBOLS2 = -h _main -h _LogError  -h _PingServer
429
430 #  else
431
432       HIDDEN_SYMBOLS1 = -h main -h BecomeDaemon -h GetHourGlass \
433                         -h Verify 
434       HIDDEN_SYMBOLS2 = -h main -h LogError  -h PingServer
435
436 #  endif
437 #endif
438
439
440
441 /**************************************************************************
442  *
443  *  Rules
444  *
445  **************************************************************************/
446
447 #if defined(USE_KRB) || defined(USE_RGY)
448 includes::
449         @for i in $(SRCS1) $(SRCS2) $(HEADERS); do \
450         $(RM) $$i; \
451         echo "linking $(DTLOGINSRC)/$$i to $$i";\
452         ln -f -s $(DTLOGINSRC)/$$i .; \
453         done
454 #endif
455
456
457 ComplexProgramTarget_1($(PROG1),$(LOCAL_LIBRARIES1), $(LOGINLDOPTIONS))
458 ComplexProgramTarget_2($(PROG2),$(LOCAL_LIBRARIES2), /**/)
459 ComplexProgramTarget_3($(PROG3),$(LOCAL_LIBRARIES3), /**/)
460
461 #ifdef __ppc
462 /* Problem with "-O" in dtgreet ... wrong size login widget. */
463 /* Override "-O" (xO2) with "-xO1". */
464 vgutil.o:
465         $(RM) $@
466         $(CC) -c $(CFLAGS) -xO1 $(_NOOP_) $*.c
467 #endif
468
469 SpecialObjectRule(resource.o, $(ICONFIGFILES), $(EXTRA_RES_DEFINES) $(RES_DEFINES) $(CCINLIBS))
470 #ifdef HPArchitecture
471 #ifndef DEBUGTREE
472 SpecialObjectRule(session.o,,+O1 $(CCINLIBS))
473 #endif
474 #endif
475
476 #if !defined(USE_KRB) && !defined(USE_RGY)
477
478 LOCAL_CPP_DEFINES = -DCDE_CONFIGURATION_TOP=$(CDE_CONFIGURATION_TOP) \
479                     -DCDE_INSTALLATION_TOP=$(CDE_INSTALLATION_TOP) \
480                     -DCDE_LOGFILES_TOP=$(CDE_LOGFILES_TOP)
481
482 #endif /* USE_KRB && USE_RGY */
483
484 #if InstallXdmConfig 
485 MakeDirectories(install,$(XDMDIR))
486 #endif
487
488 /*
489  * Don't install; let people read the instructions about putting in the
490  * abort-display() resource:
491  */
492 #ifdef comment
493 InstallProgramWithFlags(xdmshell,$(XBINDIR), /**/)
494 #endif
495
496 #if !defined(USE_KRB) && !defined(USE_RGY)
497 /***** For dtge make a client_OBJS.o using client_main.o ******/
498 /***** This implies the existence of client_main.c       ******/
499 # ifdef BuildHugeObject
500 #  if defined (HPArchitecture) && ! defined (BLS)
501 SpecialRelocatableTarget(dtlogin,$(HIDDEN_SYMBOLS1),$(OBJS1))
502 SpecialRelocatableTarget(dtgreet,$(HIDDEN_SYMBOLS2),$(OBJS2))
503 #  endif
504 # endif
505 #endif