Initial import from FreeBSD RELENG_4:
[dragonfly.git] / bin / csh / Makefile
1 # $FreeBSD: src/bin/csh/Makefile,v 1.11.2.8 2002/02/19 00:36:40 mp Exp $
2 #       @(#)Makefile    8.1 (Berkeley) 5/31/93
3 #
4 # C Shell with process control; VM/UNIX VAX Makefile
5 # Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
6 #
7 # To profile, put -DPROF in DEFS and -pg in CFLAGS, and recompile.
8
9 TCSHDIR= ${.CURDIR}/../../contrib/tcsh
10 .PATH: ${TCSHDIR}
11
12 PROG=   csh
13 SUBDIR= nls
14 DFLAGS= -D_PATH_TCSHELL='"/bin/${PROG}"'
15 CFLAGS+= -I. -I${.CURDIR} -I${TCSHDIR} ${DFLAGS}
16 SRCS=   sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \
17         sh.exp.c sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c \
18         sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \
19         sh.set.c sh.time.c sh.char.h sh.dir.h sh.proc.h sh.h
20 SRCS+=  sh.decls.h glob.c glob.h mi.termios.c mi.wait.h mi.varargs.h
21 SRCS+=  tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
22         tw.comp.c tw.color.c
23 SRCS+=  ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \
24         ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h
25 SRCS+=  tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \
26         tc.func.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \
27         tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \
28         tc.who.c tc.h
29 GENHDRS= ed.defns.h sh.err.h tc.const.h tc.defs.c
30 SRCS+=  ${GENHDRS}
31
32 MLINKS= csh.1 tcsh.1
33 # MLINKS for Shell built in commands for which there are no userland
34 # utilities of the same name are handled with the associated manpage,
35 # builtin.1 in share/man/man1/.
36
37 DPADD=  ${LIBTERMCAP} ${LIBCRYPT}
38 LDADD=  -ltermcap -lcrypt
39
40 LINKS=  ${BINDIR}/csh ${BINDIR}/tcsh
41
42 CLEANFILES= ${GENHDRS} gethost csh.1
43
44 FILESDIR= ${SHAREDIR}/examples/tcsh
45 FILES= complete.tcsh csh-mode.el
46
47 csh.1: tcsh.man
48         ln -sf ${.ALLSRC} ${.TARGET}
49
50 build-tools: gethost
51
52 gethost: gethost.c sh.err.h tc.const.h sh.h
53         @rm -f ${.TARGET}
54         ${CC} -o gethost ${LDFLAGS} ${CFLAGS} ${TCSHDIR}/gethost.c
55
56 tc.defs.c: gethost ${.CURDIR}/host.defs
57         @rm -f ${.TARGET}
58         @echo "/* Do not edit this file, make creates it */" > ${.TARGET}
59         ./gethost ${.CURDIR}/host.defs >> ${.TARGET}
60
61 ed.defns.h: ed.defns.c
62         @rm -f ${.TARGET}
63         @echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
64         @echo '#ifndef _h_ed_defns' >> ${.TARGET}
65         @echo '#define _h_ed_defns' >> ${.TARGET}
66         grep '[FV]_' ${TCSHDIR}/ed.defns.c | grep '^#define' >> ${.TARGET}
67         @echo '#endif /* _h_ed_defns */' >> ${.TARGET}
68
69 sh.err.h: sh.err.c
70         @rm -f ${.TARGET}
71         @echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
72         @echo '#ifndef _h_sh_err' >> ${.TARGET}
73         @echo '#define _h_sh_err' >> ${.TARGET}
74         grep 'ERR_' ${.ALLSRC} | grep '^#define' >> ${.TARGET}
75         @echo '#endif /* _h_sh_err */' >> ${.TARGET}
76
77 tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h
78         @rm -f ${.TARGET}
79         @echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
80         @echo '#ifndef _h_tc_const' >> ${.TARGET}
81         @echo '#define _h_tc_const' >> ${.TARGET}
82         ${CC} -E ${CFLAGS} ${.ALLSRC} -D_h_tc_const | grep 'Char STR' | \
83             sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | \
84             sort >> ${.TARGET}
85         @echo '#endif /* _h_tc_const */' >> ${.TARGET}
86
87 .include <bsd.prog.mk>