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