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