1# $MirOS: src/lib/libedit/Makefile,v 1.10 2009/08/30 18:01:18 tg Exp $
2# $NetBSD: Makefile,v 1.29 2003/12/05 13:37:48 lukem Exp $
3# @(#)Makefile	8.1 (Berkeley) 6/4/93
4
5SHLIB_VERSION?=	7.0
6
7LIB=	edit
8DPADD+=	${LIBTERMCAP}
9LDADD+=	-ltermcap
10
11OSRCS=	chared.c common.c el.c emacs.c fcns.c help.c hist.c key.c map.c \
12	parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c
13
14MAN=	editline.3 editrc.5
15
16MLINKS=	editline.3 el_init.3 editline.3 el_end.3 editline.3 el_reset.3 \
17	editline.3 el_gets.3 editline.3 el_getc.3 editline.3 el_push.3 \
18	editline.3 el_parse.3 editline.3 el_set.3 editline.3 el_get.3 \
19	editline.3 el_source.3 editline.3 el_resize.3 editline.3 el_line.3 \
20	editline.3 el_insertstr.3 editline.3 el_deletestr.3 \
21	editline.3 history_init.3 editline.3 history_end.3 \
22	editline.3 history.3 \
23	editline.3 tok_init.3 editline.3 tok_end.3 editline.3 tok_reset.3 \
24	editline.3 tok_line.3 editline.3 tok_str.3
25
26# For speed and debugging
27#SRCS=		${OSRCS} tokenizer.c history.c readline.c
28# For protection
29SRCS=		editline.c tokenizer.c history.c readline.c
30
31LIBEDITDIR?=	${.CURDIR}
32
33HDRS2=		histedit.h histedit.h readline/readline.h readline/readline.h
34
35.include <bsd.own.mk>
36CLEANFILES+=	editline.c
37CLEANFILES+=	common.h.tmp editline.c.tmp emacs.h.tmp fcns.c.tmp fcns.h.tmp
38CLEANFILES+=	help.c.tmp help.h.tmp vi.h.tmp test.o test
39COPTS+=		-Wall
40CPPFLAGS+=	-I. -I${LIBEDITDIR}
41#CPPFLAGS+=	-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH
42#CPPFLAGS+=	-DDEBUG_PASTE -DDEBUG_EDIT
43
44AHDR=		vi.h emacs.h common.h
45ASRC=		${LIBEDITDIR}/vi.c ${LIBEDITDIR}/emacs.c ${LIBEDITDIR}/common.c
46
47DPSRCS+=	${AHDR} fcns.h help.h fcns.c help.c
48CLEANFILES+=	${AHDR} fcns.h help.h fcns.c help.c
49
50vi.h: vi.c makelist
51	${SHELL} ${LIBEDITDIR}/makelist -h ${LIBEDITDIR}/vi.c \
52	    > ${.TARGET}.tmp && \
53	    mv ${.TARGET}.tmp ${.TARGET}
54
55emacs.h: emacs.c makelist
56	${SHELL} ${LIBEDITDIR}/makelist -h ${LIBEDITDIR}/emacs.c \
57	    > ${.TARGET}.tmp && \
58	    mv ${.TARGET}.tmp ${.TARGET}
59
60common.h: common.c makelist
61	${SHELL} ${LIBEDITDIR}/makelist -h ${LIBEDITDIR}/common.c \
62	    > ${.TARGET}.tmp && \
63	    mv ${.TARGET}.tmp ${.TARGET}
64
65fcns.h: ${AHDR} makelist
66	${SHELL} ${LIBEDITDIR}/makelist -fh ${AHDR} > ${.TARGET}.tmp && \
67	    mv ${.TARGET}.tmp ${.TARGET}
68
69fcns.c: ${AHDR} fcns.h help.h makelist
70	${SHELL} ${LIBEDITDIR}/makelist -fc ${AHDR} > ${.TARGET}.tmp && \
71	    mv ${.TARGET}.tmp ${.TARGET}
72
73help.c: ${ASRC} makelist
74	${SHELL} ${LIBEDITDIR}/makelist -bc ${ASRC} > ${.TARGET}.tmp && \
75	    mv ${.TARGET}.tmp ${.TARGET}
76
77help.h: ${ASRC} makelist
78	${SHELL} ${LIBEDITDIR}/makelist -bh ${ASRC} > ${.TARGET}.tmp && \
79	    mv ${.TARGET}.tmp ${.TARGET}
80
81editline.c: ${OSRCS}
82	${SHELL} ${LIBEDITDIR}/makelist -e ${.ALLSRC:T} > ${.TARGET}.tmp && \
83	    mv ${.TARGET}.tmp ${.TARGET}
84
85test.o: ${LIBEDITDIR}/TEST/test.c
86
87test: test.o libedit.a
88	${CC} ${LDFLAGS} ${LDSTATIC} -o $@ ${.ALLSRC} ${LDADD} -lotermcap
89
90afterincludes:
91	cd ${HDRDST:Q}/readline; \
92	    if [[ $$(readlink history.h 2>&-) != readline.h ]]; then \
93		rm -f history.h; \
94		ln -sf readline.h history.h; \
95	fi
96
97.include <bsd.lib.mk>
98
99.if ${CROSS_MODE:L} != "yes"
100all: test
101.endif
102