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