--- a/Makefile
+++ b/Makefile
@@ -9,17 +9,21 @@
 DFLAGS=-DBUILTIN -DFILEC -DNLS -DSHORT_STRINGS
 #CFLAGS+=-g
 #CFLAGS+=-Wall
-CFLAGS+=-I${.CURDIR} -I. ${DFLAGS}
+CFLAGS+=${CPPFLAGS} ${DFLAGS}
 SRCS=	alloc.c char.c const.c csh.c dir.c dol.c error.c exec.c exp.c file.c \
 	func.c glob.c hist.c init.c lex.c misc.c parse.c proc.c \
 	sem.c set.c str.c time.c
 
-CLEANFILES+=error.h const.h
+CLEANFILES=*.o csh
 
-.if (${MACHINE_ARCH} == "vax")
-alloc.o:
-	${CC} ${CFLAGS} ${CPPFLAGS} -O0 -c $<
-.endif
+all:
+	${CC} -o ${PROG} ${CFLAGS} -DBIONIC ${SRCS} ${LDFLAGS} -lbsd -landroid-glob -lc
+
+clean:
+	rm -f ${CLEANFILES}
+
+install:
+	install -p csh ${PREFIX}/bin/
 
 const.h: error.h
 
@@ -28,16 +32,14 @@
 	@echo '/* Do not edit this file, make creates it. */' > $@
 	@echo '#ifndef _h_sh_err' >> $@
 	@echo '#define _h_sh_err' >> $@
-	egrep 'ERR_' ${.CURDIR}/$*.c | egrep '^#define' >> $@
+	egrep -h 'ERR_' *.c | egrep '^#define' >> $@
 	@echo '#endif /* _h_sh_err */' >> $@
 
 const.h: const.c
 	@rm -f $@
 	@echo '/* Do not edit this file, make creates it. */' > $@
-	${CC} -E ${CFLAGS} ${.CURDIR}/$*.c | egrep 'Char STR' | \
+	${CC} -E ${CFLAGS} *.c | egrep 'Char STR' | grep -v 'static ' | \
 	    sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | \
 	    sort >> $@
 
 .depend alloc.o: const.h error.h 
-
-.include <bsd.prog.mk>
