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