]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/tcsh/Imakefile
login(1): when exporting variables check the result of setenv(3)
[FreeBSD/FreeBSD.git] / contrib / tcsh / Imakefile
1 XCOMM
2 XCOMM Imakefile for tcsh 6.12
3 XCOMM Marc Horowitz, MIT SIPB
4 XCOMM
5
6 #ifdef DestDir
7 #undef DestDir
8 #endif
9 #ifdef ManSuffix
10 #undef ManSuffix
11 #endif
12
13 /* All config options go in a separate file. */
14
15 #include "imake.config"
16
17 #ifndef HasGcc
18 # define HasGcc 0
19 #endif
20
21 #ifndef HasGcc2
22 # define HasGcc2 0
23 #endif
24
25 /* This is a giant conditional block.  It should be set up right for
26 platforms which are in here, but it may need to be changed for new
27 ones.  Please send in your fixes and additions! */
28
29 /**** tcsh configuration defines ****/
30
31 /* specific platforms */
32
33 #ifndef ConfigH
34 # ifdef UltrixArchitecture
35 #  define ConfigH ultrix
36 # endif
37
38 # ifdef UxpArchitecture
39 #  define ConfigH sysv4
40 # endif
41
42 # if defined(LinuxArchitecture) || defined(GNUArchitecture)
43 #  define ConfigH linux
44 # endif
45
46 # ifdef AlphaArchitecture
47 #  if !defined(LinuxArchitecture) && !defined(GNUArchitecture)
48 #    define ConfigH decosf1
49 #  endif
50 #  if !HasGcc
51 #   define MyCflags -std1 -Olimit 2000
52 #  else
53 #   define NoCombineRegs
54 #  endif
55 # endif
56
57 # if defined(VaxArchitecture) && !defined(UltrixArchitecture)
58 #  define ConfigH bsd
59 # endif
60
61 # ifdef NeXTArchitecture
62 #  define ConfigH mach
63 # endif
64
65 # if defined(SunArchitecture)
66 #  if (OSMajorVersion == 3)
67 #   define ConfigH sunos35
68 #  else
69 #   if (OSMajorVersion == 4)
70 #    if (OSMinorVersion == 0)
71 #     define ConfigH sunos40
72 #    else /* OSMinorVersion == 1 */
73 #     if (OSTeenyVersion == 3)
74 #      define ConfigH sunos413
75 #     else /* OsTeenyVersion in [0,1,2] */
76 #      define ConfigH sunos41
77 #     endif
78 #    endif
79 #    define NoCombineRegs
80 #   else /* OSMajorVersion == 5 */
81 #    if (OSMinorVersion < 3)
82 #     if (OSMinorVersion < 2)
83 #      define ConfigH sol2
84 #     else
85 #      define ConfigH sol22
86 #     endif
87 #    else
88 #     if (OSMinorVersion < 4)
89 #      define ConfigH sol23
90 #     else
91 #      if (OSMinorVersion < 6)
92 #       define ConfigH sol24
93 #      else
94 #       if (OSMinorVersion < 9)
95 #        define ConfigH sol26
96 #       else
97 #        define ConfigH sol29
98 #       endif
99 #      endif
100 #     endif
101 #    endif
102 #    define NoCombineRegs
103 #   endif
104 #  endif
105 # endif
106
107 # ifdef HPArchitecture
108 /* For some stupid reason makedepend on HP requires this */
109 DEPENDFLAGS = -o.o
110 #  if (OSMajorVersion >= 8)
111 #   define ConfigH hpux8
112 #  else
113 #   define ConfigH hpux7
114 #  endif
115 # endif
116
117 # ifdef CrayArchitecture
118 #  define ConfigH cray
119 # endif
120
121 # ifdef SGIArchitecture
122 #   define ConfigH irix
123 #   define UseLibBSD
124 #  if (OSMajorVersion < 5)
125 #   ifdef you_are_using_yp
126 #    define UseSunLib 
127 #   endif
128 #   if !HasGCC
129 #    define MyStdc -D__STDC__
130 #    if SGICompilerMajorVersion < 4
131 CCOPTIONS=-float        # We don't want -cckr and -prototypes
132 #    endif
133 #   endif
134 #  endif
135 #  if (OSMajorVersion == 6)
136 #   if (OSMinorVersion >= 2)
137 #    undef UseLibBSD
138 #    define ConfigH irix62
139 #   endif
140 #  endif
141 # endif
142
143 # ifdef IBMArchitecture
144 #  undef UseLibBSD
145 #  if (SystemV == YES)
146 #   define ConfigH aix
147 #   if OSMajorVersion < 3 
148 #    if OSMinorVersion < 2
149 #     define UseLibBSD
150 #    endif
151 #   endif
152 #  else
153 #   define ConfigH bsd
154 #   define AOSArchitecture
155 #  endif
156 # endif
157
158
159 #ifdef AOSArchitecture
160 #define MyStdc -U__STDC__
161 #endif
162
163 # if defined(MipsBsdArchitecture) || defined(MipsSysvArchitecture)
164 #  define ConfigH mips
165 # endif
166
167 # ifdef DguxArchitecture
168 #  define ConfigH dgux
169 # endif
170
171 # ifdef ConvexArchitecture
172 #  define ConfigH convex
173 # endif
174
175 # if defined(SQNTArchitecture) || defined(SequentArchitecture)
176 #  define ConfigH sequent
177 # endif
178
179 # ifdef MacIIArchitecture
180 #  define ConfigH mac2
181 # endif
182
183 # ifdef MinixArchitecture
184 /* Maybe conditional on MACH? */
185 SYSSRCS=mi.termios.c mi.wait.h mi.varargs.h
186 SYSOBJS=mi.termios.${SUF}
187 EXTF=ma.setp.c vms.termcap.c
188 # else
189 /* Maybe conditional on MACH? */
190 SYSSRCS=ma.setp.c
191 SYSOBJS=ma.setp.${SUF}
192 EXTF=mi.termios.c mi.wait.h mi.varargs.h vms.termcap.c
193 # endif
194
195 # ifdef i386Isc
196 #  if IscVersion != 202
197 #   define ConfigH isc
198 #   define UseLibCposix
199 #  else
200 #   define ConfigH isc202
201 #  endif
202 # endif /* i386Isc */
203
204 # ifdef OpenBSDArchitecture
205 #  define ConfigH bsd4.4
206 # endif /* OpenBsdArchitecture */
207
208 # ifdef NetBSDArchitecture
209 #  define ConfigH bsd4.4
210 # endif /* NetBsdArchitecture */
211
212 # ifdef FreeBSDArchitecture
213 #  define ConfigH bsd4.4
214 # endif /* FreeBsdArchitecture */
215
216 # ifdef MidnightBSDArchitecture
217 #  define ConfigH bsd4.4
218 # endif /* MidnightBsdArchitecture */
219
220 # ifdef i386SVR4Architecture
221 #  define ConfigH sysv4
222 #  ifdef DELL
223 #   define NoCombineRegs
224 #  endif
225 # endif
226
227 #endif /* !ConfigH */
228
229 /* generic os's */
230
231 #ifndef ConfigH
232
233 #if (SystemV == YES)
234 #define ConfigH sysv3
235 #else
236 /* why this as a default?  Why not? */
237 #define ConfigH bsd
238 #endif
239
240 #endif /* !ConfigH */
241
242 /**** libraries ****/
243
244 #if (SystemV == NO) || defined(HPArchitecture) || \
245         defined(SQNTArchitecture) || defined(SequentArchitecture) || \
246         defined(MacIIArchitecture) || defined(UseLibTermcap)
247 LIBTERMCAP = -ltermcap
248 #else
249 LIBTERMCAP =
250 #endif
251
252 #if defined(SQNTArchitecture) || defined(SequentArchitecture)
253 LIBSQNT=-lsocket -linet -lnsl -lseq
254 #endif
255
256 /* This may not be good enough - I don't have access to enough systems
257 to really test it. */
258 #if (SystemV == YES) || defined(UseLibCurses) && !defined(HPArchitecture)
259 LIBCURSES = -lcurses
260 #else
261 LIBCURSES =
262 #endif
263
264 #if defined(UseLibNet)
265 LIBNET = -lnet
266 #else
267 LIBNET =
268 #endif
269
270 #if defined(UseLibSocket)
271 LIBSOCKET = -lsocket
272 #else
273 LIBSOCKET =
274 #endif
275
276 #if defined(UseLibBSD)
277 LIBBSD = -lbsd
278 #else
279 LIBBSD = 
280 #endif
281
282 #if (defined(SGIArchitecture) && \
283      (OSMajorVersion == 3) && (OSMinorVersion == 3)) || \
284         defined(UseLibC_S)
285 LIBC_S = -lc_s
286 #else
287 LIBC_S =
288 #endif
289
290 #if defined(UseLibSun)
291 LIBSUN = -lsun
292 #else
293 LIBSUN =
294 #endif
295
296 #if defined(UseLibCposix)
297 LIBCPOSIX = -lcposix
298 #else
299 LIBCPOSIX =
300 #endif
301
302 #if defined(UseLibInet)
303 LIBINET = -linet
304 #else
305 LIBINET =
306 #endif
307
308 #if defined(UseLibDir)
309 LIBDIRECT = -ldir
310 #else
311 LIBDIRECT = 
312 #endif
313
314 #if defined(UseLibX)
315 LIBX = -lx
316 #else
317 LIBX =
318 #endif
319
320 #if defined(UseLibIntl)
321 LIBINTL = -lintl
322 #else
323 LIBINTL =
324 #endif
325
326 #if (HasLibCrypt == YES)
327 LIBCRYPT = -lcrypt
328 #else
329 LIBCRYPT =
330 #endif
331
332 #if defined(MacIIArchitecture) || defined(UseLibPosix)
333 LIBPOSIX = -lposix
334 #else
335 LIBPOSIX =
336 #endif
337
338 #if defined(ATTArchitecture) || defined(UseLibDirent)
339 LIBDIRECTENT = -ldirent
340 #else
341 LIBDIRECTENT =
342 #endif
343
344 /* The order here is significant.  Although nothing uses all of these, 
345 some platforms which use more than one do care about the order. */
346
347 SYSLIBS = $(LIBPOSIX) $(LIBDIRECTENT) $(LIBTERMCAP) $(LIBCURSES) \
348         $(LIBNET) $(LIBINTL) $(LIBSOCKET) $(LIBSUN) $(LIBBSD) $(LIBCPOSIX) \
349         $(LIBINET) $(LIBDIRECT) $(LIBX) $(LIBC_S) $(LIBSQNT) $(LIBCRYPT)
350
351 /* Past here, nothing should need to be changed to compile on a different
352 platform, unless you have a really weird architecture. */
353
354 #ifdef MyCC
355 CC = MyCC
356 #else
357 # if HasGcc
358 #  if HasGcc2
359 CC = gcc 
360 #  else
361 #   ifdef NoCombineRegs
362 CC = gcc -finline-functions -fstrength-reduce
363 #   else
364 CC = gcc -fcombine-regs -finline-functions -fstrength-reduce
365 #   endif
366 #  endif
367 # else
368 CC = cc
369 # endif
370 #endif
371
372 #ifdef HESIOD
373 HESLIB = -L/usr/athena/lib -lhesiod
374 /* it seems to me that the -I shouldn't be necessary, but there seems
375 to be a bug in the Imake stuff, so here it is. */
376 HESDEF = -DHESIOD -I/usr/athena/include
377 #else
378 HESLIB =
379 HESDEF =
380 #endif
381
382 #ifdef AFS
383 #ifndef AFSDIR
384 AFSDIR = /usr/afsws
385 #endif
386 #ifdef AFS33
387 #define AFS33LIB -laudit
388 #else
389 #define AFS33LIB
390 #endif
391 /* Auxilliary libs needed for AFS */
392 /* Both HPUX and Solaris need the BSD libraries.  We need -lc before
393  * the bsd library to avoid using any more of it than is necessary.
394  */
395 #if defined(HPArchitecture)
396 #define AFSAUXLIB -lc -lBSD
397 /* This is probably a kludge, but so is imake. */
398 #else
399 #if defined(SunArchitecture) && (OSMajorVersion == 5)
400 #define AFSAUXLIB -lsocket -lnsl -lc -lucb
401 #else
402 #define AFSAUXLIB
403 #endif
404 #endif /* AFSAUXLIB */
405 AFSLIB = -L$(AFSDIR)/lib -L$(AFSDIR)/lib/afs -lkauth -lprot -lubik\
406          -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err\
407          $(AFSDIR)/lib/afs/util.a AFS33LIB AFSAUXLIB
408 AFSDEF = -DAFS -I$(AFSDIR)/include
409 #else
410 AFSLIB =
411 AFSDEF =
412 #endif
413
414 /* This is encore specific, but I don't know what encore's #define is,
415 and it shouldn't hurt to have it here, so here it is */
416 PARALLEL=12                             # Make the multi-max run fast.
417
418 #ifndef TcshTop
419 #define TcshTop /usr/local
420 #endif
421 TCSHTOP = TcshTop
422
423 #ifndef ManSuffix
424 #define ManSuffix 1
425 #endif
426 MANSUFFIX = ManSuffix
427
428 #ifdef TcshPath
429 PATH_TCSHELL = TcshPath
430 TCSHPATH = -D_PATH_TCSHELL='"$(PATH_TCSHELL)"'
431 #else
432 TCSHPATH =
433 #endif
434
435 #ifdef DestBin
436 TCSH_BINDIR = DestBin
437 #else
438 TCSH_BINDIR = $(TCSHTOP)/bin
439 #endif
440 #ifdef DestMan
441 TCSH_MANDIR = DestMan
442 #else
443 TCSH_MANDIR = $(TCSHTOP)/man/man$(MANSUFFIX)
444 #endif
445
446 LOCALLIBS =
447
448 #ifndef MyCflags
449 #define MyCflags
450 #endif
451
452 #ifndef MyDefines
453 #define MyDefines
454 #endif
455
456 #ifndef MyIncludes
457 #define MyIncludes
458 #endif
459
460 #ifndef MyStdc
461 #define MyStdc
462 #endif
463
464 #ifdef CDebugFlags
465 CDEBUGFLAGS = CDebugFlags
466 #else
467 # if HasGcc2
468 CDEBUGFLAGS = -O2
469 # else
470 CDEBUGFLAGS = -O
471 # endif
472 #endif
473
474
475 #ifdef HostType
476 HOSTTYPE=HostType
477 HTDEF = -DHOSTTYPE='"$(HOSTTYPE)"'
478 #else
479 HTDEF =
480 #endif
481
482 DEFINES = $(TCSHPATH) $(HESDEF) $(AFSDEF) $(HTDEF) MyDefines MyCflags MyStdc
483 INCLUDES = -I. MyIncludes
484 #ifdef MyLibs
485 LDLIBS = MyLibs
486 #endif
487
488 SUF = o
489 VERSION = 6.12
490
491 SHSRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c \
492         sh.char.c sh.exp.c sh.file.c sh.func.c \
493         sh.glob.c sh.hist.c sh.init.c sh.lex.c \
494         sh.misc.c sh.parse.c sh.print.c sh.proc.c \
495         sh.sem.c sh.set.c sh.time.c glob.c \
496         sh.char.h sh.dir.h sh.proc.h sh.h \
497         sh.decls.h glob.h ${SYSSRCS}
498 SHOBJS= sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \
499         sh.char.${SUF} sh.exp.${SUF} sh.file.${SUF} sh.func.${SUF} \
500         sh.glob.${SUF} sh.hist.${SUF} sh.init.${SUF} sh.lex.${SUF} \
501         sh.misc.${SUF} sh.parse.${SUF} sh.print.${SUF} sh.proc.${SUF} \
502         sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} glob.${SUF} ${SYSOBJS}
503
504 TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
505         tw.comp.c tw.color.c
506 TWOBJS= tw.help.${SUF} tw.init.${SUF} tw.parse.${SUF} tw.spell.${SUF} \
507         tw.comp.${SUF} tw.color.${SUF}
508
509 EDSRCS= ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \
510         ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h
511 EDOBJS= ed.chared.${SUF} ed.refresh.${SUF} ed.screen.${SUF} ed.init.${SUF} \
512         ed.inputl.${SUF} ed.defns.${SUF} ed.xmap.${SUF} ed.term.${SUF}
513
514 TCSRCS= tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \
515         tc.func.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \
516         tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \
517         tc.who.c tc.h 
518 TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \
519         tc.disc.${SUF} tc.func.${SUF} tc.os.${SUF} tc.printf.${SUF} \
520         tc.prompt.${SUF} tc.sched.${SUF} tc.sig.${SUF} tc.str.${SUF} \
521         tc.vers.${SUF} tc.who.${SUF} 
522
523 MISCF = Makefile.std BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md \
524         FAQ WishList config_f.h eight-bit.me glob.3 patchlevel.h pathnames.h \
525         tcsh.man Ported src.desc Imakefile imake.config complete.tcsh \
526         Makefile.vms termcap.vms snames.h host.defs gethost.c tcsh.man2html \
527         Makefile.in configure.ac Makefile.win32 aclocal.m4
528 CONFSRCS=config/[a-z]*
529
530
531 SRCS = $(SHSRCS) $(TWSRCS) $(EDSRCS) $(TCSRCS)
532 OBJS = $(SHOBJS) $(TWOBJS) $(EDOBJS) $(TCOBJS)
533
534 ALLSRCS= $(MISCF) $(SRCS) $(EXTF)
535
536 AllTarget(tcsh)
537
538 ed.defns.h: config.h ed.defns.c
539         @rm -f $@
540         @echo '/* Do not edit this file, make creates it. */' > $@
541         @echo '#ifndef _h_ed_defns' >> $@
542         @echo '#define _h_ed_defns' >> $@
543         egrep '[FV]_' ed.defns.c | egrep '^#define' >> $@
544         @echo '#endif /* _h_ed_defns */' >> $@
545
546 sh.err.h: config.h sh.err.c
547         @rm -f $@
548         @echo '/* Do not edit this file, make creates it. */' > $@
549         @echo '#ifndef _h_sh_err' >> $@
550         @echo '#define _h_sh_err' >> $@
551         egrep 'ERR_' sh.err.c | egrep '^#define' >> $@
552         @echo '#endif /* _h_sh_err */' >> $@
553
554 tc.const.h: config.h tc.const.c
555         @rm -f $@
556         @echo '/* Do not edit this file, make creates it. */' > $@
557         @echo '#ifndef _h_tc_const' >> $@
558         @echo '#define _h_tc_const' >> $@
559         ${CC} -E $(INCLUDES) ${DEFINES} -D_h_tc_const tc.const.c | \
560             grep 'Char STR' | \
561             sed -e 's/Char \([a-zA-Z0-9_]*\)\[\].*/extern Char \1[];/' | \
562             sort >> $@
563         @echo '#endif /* _h_tc_const */' >> $@
564
565 config.h: config_f.h
566         cp config/ConfigH config.h
567
568 $(OBJS): sh.err.h tc.const.h ed.defns.h
569
570 tar.Z:
571         rm -f tcsh-${VERSION}.tar.Z
572         rm -rf tcsh-${VERSION} 
573         mkdir tcsh-${VERSION} tcsh-${VERSION}/config
574         cp ${ALLSRCS} tcsh-${VERSION}
575         cp ${CONFSRCS} tcsh-${VERSION}/config
576         tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
577         tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z
578         rm -rf tcsh-${VERSION}
579
580 tar.gz:
581         rm -f tcsh-${VERSION}.tar.gz
582         rm -rf tcsh-${VERSION} 
583         mkdir tcsh-${VERSION} tcsh-${VERSION}/config
584         cp ${ALLSRCS} tcsh-${VERSION}
585         cp ${CONFSRCS} tcsh-${VERSION}/config
586         tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
587         tar cvf - tcsh-${VERSION} | gzip > tcsh-${VERSION}.tar.gz
588         rm -rf tcsh-${VERSION}
589
590 shar:
591         rm -f tcsh-*.shar
592         rm -rf tcsh-${VERSION} 
593         mkdir tcsh-${VERSION} tcsh-${VERSION}/config
594         cp ${ALLSRCS} tcsh-${VERSION}
595         cp ${CONFSRCS} tcsh-${VERSION}/config
596         tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
597         MAKESHAR -v -n tcsh-${VERSION} tcsh-${VERSION} \
598                  tcsh-${VERSION}/?* tcsh-${VERSION}/config/?* \
599                  tcsh-${VERSION}/?*/set?*
600         rm -rf tcsh-${VERSION}
601
602 catalogs:
603         @(cd nls; make catalogs)
604         
605 world:
606         $(MAKE) clean ; $(MAKE) depend ; $(MAKE) tcsh ; $(MAKE) install
607
608 clean::
609         rm -f ed.defns.h sh.err.h tc.const.h config.h tc.defs.*
610         rm -f tcsh.*.m tcsh.*.cat
611
612 depend:: config.h ed.defns.h sh.err.h tc.const.h $(SRCS) tc.defs.c
613
614 tc.defs.${SUF}: tc.defs.c sh.h
615
616 tc.defs.c:      gethost host.defs
617         @rm -f $@
618         @echo "/* Do not edit this file, make creates it */" > $@
619         ./gethost host.defs >> $@
620
621 ALIB=$(HESLIB) $(AFSLIB) $(SYSLIBS)
622 AINC=ed.defns.h sh.err.h tc.const.h sh.h
623
624 NormalProgramTarget(tcsh, $(OBJS), $(AINC), $(LOCALLIBS), $(ALIB))
625 NormalProgramTarget(gethost, gethost.${SUF}, $(AINC), $(LOCALLIBS), $(ALIB))
626
627 InstallProgram(tcsh,$(TCSH_BINDIR))
628 InstallManPage(tcsh,$(TCSH_MANDIR))
629 DependTarget()