1 # $NetBSD: Makefile,v 1.68 2003/10/18 07:58:35 lukem Exp $ 2 # @(#)Makefile 8.4 (Berkeley) 5/5/95 3 4 .include <bsd.own.mk> 5 6 YHEADER=1 7 PROG= sh 8 SHSRCS= alias.c cd.c echo.c error.c eval.c exec.c expand.c \ 9 histedit.c input.c jobs.c mail.c main.c memalloc.c miscbltin.c \ 10 mystring.c options.c parser.c redir.c show.c trap.c output.c var.c \ 11 test.c printf.c kill.c 12 GENSRCS=arith.c arith.h arith_lex.c builtins.c builtins.h init.c nodes.c \ 13 nodes.h syntax.c syntax.h token.h 14 SRCS= ${SHSRCS} ${GENSRCS} 15 16 LDADD+= -ll -ledit -ltermcap 17 DPADD+= ${LIBL} ${LIBEDIT} ${LIBTERMCAP} 18 19 LFLAGS= -8 # 8-bit lex scanner for arithmetic 20 YFLAGS= -d 21 22 .ifdef CRUNCHEDPROG 23 LFLAGS+=-L 24 YFLAGS+=-l 25 .endif 26 27 CPPFLAGS+=-DSHELL -I. -I${.CURDIR} 28 #XXX: For testing only. 29 #CPPFLAGS+=-DDEBUG=1 30 #CFLAGS+=-funsigned-char 31 #TARGET_CHARFLAG?= -DTARGET_CHAR="unsigned char" -funsigned-char 32 33 .ifdef SMALLPROG 34 CPPFLAGS+=-DSMALL 35 .endif 36 37 .PATH: ${.CURDIR}/bltin ${NETBSDSRCDIR}/bin/test \ 38 ${NETBSDSRCDIR}/usr.bin/printf \ 39 ${NETBSDSRCDIR}/bin/kill 40 41 CLEANFILES+= mkinit mknodes mksyntax 42 CLEANFILES+= ${GENSRCS} y.tab.h 43 CLEANFILES+= trace 44 45 token.h: mktokens 46 ${HOST_SH} ${.ALLSRC} 47 48 builtins.h: builtins.c 49 [ -f ${.TARGET} ] 50 51 builtins.c: mkbuiltins shell.h builtins.def 52 ${HOST_SH} ${.ALLSRC} ${.OBJDIR} 53 [ -f builtins.h ] 54 touch builtins.h 55 56 init.c: mkinit ${SHSRCS} 57 ./${.ALLSRC} 58 59 nodes.h: nodes.c 60 [ -f ${.TARGET} ] 61 62 nodes.c: mknodes nodetypes nodes.c.pat 63 ./${.ALLSRC} 64 [ -f nodes.h ] 65 touch nodes.h 66 67 syntax.h: syntax.c 68 [ -f ${.TARGET} ] 69 70 syntax.c: mksyntax 71 ./${.ALLSRC} 72 [ -f syntax.h ] 73 touch syntax.h 74 75 .if ${USETOOLS} == "yes" 76 COMPATOBJDIR!= cd ${NETBSDSRCDIR}/tools/compat && ${PRINTOBJDIR} 77 NBCOMPATLIB= -L${COMPATOBJDIR} -lnbcompat 78 .endif 79 80 mkinit: mkinit.c 81 ${HOST_LINK.c} -o mkinit ${.IMPSRC} ${NBCOMPATLIB} 82 83 mknodes: mknodes.c 84 ${HOST_LINK.c} -o mknodes ${.IMPSRC} ${NBCOMPATLIB} 85 86 .if (${MACHINE_ARCH} == "powerpc") || \ 87 (${MACHINE_CPU} == "arm") 88 TARGET_CHARFLAG?= -DTARGET_CHAR="unsigned char" 89 .else 90 TARGET_CHARFLAG?= -DTARGET_CHAR="signed char" 91 .endif 92 93 mksyntax: mksyntax.c 94 ${HOST_LINK.c} ${TARGET_CHARFLAG} -o mksyntax ${.IMPSRC} ${NBCOMPATLIB} 95 96 .include <bsd.prog.mk> 97 98 ${OBJS}: builtins.h nodes.h syntax.h token.h 99