summaryrefslogtreecommitdiffstats
path: root/source/ap/ash/patches/ash-makefile.patch
blob: c3b16a1f58f7ea010180e41113068b306ba2b824 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
diff -u ash-0.4.0/Makefile ash-0.4.0-/Makefile
--- ash-0.4.0/Makefile	Fri Jan 12 17:50:34 2001
+++ ash-0.4.0-/Makefile	Tue Apr 24 00:49:56 2001
@@ -7,56 +7,68 @@
 SHSRCS=	alias.c cd.c echo.c error.c eval.c exec.c expand.c \
 	histedit.c input.c jobs.c mail.c main.c memalloc.c miscbltin.c \
 	mystring.c options.c parser.c redir.c show.c trap.c output.c var.c \
-	test.c
-GENSRCS=arith.c arith.h arith_lex.c builtins.c builtins.h init.c nodes.c \
-	nodes.h syntax.c syntax.h token.h
+	test.c setmode.c test.c
+GENSRCS=builtins.c builtins.h init.c nodes.c arith.c arith.h lex.yy.c \
+	nodes.h syntax.c syntax.h token.h signames.c
 SRCS=	${SHSRCS} ${GENSRCS}
 
-LDADD+=	-ll -ledit -ltermcap
-DPADD+=	${LIBL} ${LIBEDIT} ${LIBTERMCAP}
+OBJS=alias.o cd.o bltin/echo.o error.o eval.o exec.o expand.o \
+	histedit.o input.o jobs.o mail.o main.o memalloc.o miscbltin.o \
+	mystring.o options.o output.o parser.o redir.o show.o \
+	trap.o var.o bltin/test.o signames.o \
+	builtins.o init.o nodes.o syntax.o arith.o lex.yy.o \
+	setmode.o bltin/times.o
+
+OPT_FLAGS=-O2 -g
+LDFLAGS=-g
+CFLAGS=$(OPT_FLAGS) -DSHELL -I. -DNO_HISTORY -DBSD=1 -DSMALL -D_GNU_SOURCE \
+	-DGLOB_BROKEN -D__COPYRIGHT\(x\)= -D__RCSID\(x\)= -D_DIAGASSERT\(x\)=
+
+all: $(PROG)
+
+$(PROG): build-tools $(GENSRCS) $(GENHDRS) $(OBJS)
+	$(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(LDLIBS) -lfl
+	
+lex.yy.c: arith_lex.l
+	flex -8 $< 
+	
+CLEANFILES+= mkinit mkinit.o mknodes mknodes.o \
+	mksyntax mksyntax.o
+	
+CLEANFILES+= ${GENSRCS} ${GENHDRS}
+
+build-tools: mkinit mknodes mksyntax
+
+.ORDER: builtins.c builtins.h
+builtins.c builtins.h: mkbuiltins builtins.def
+	sh mkbuiltins shell.h builtins.def `pwd`
+
+INIT_DEPS = alias.c eval.c exec.c input.c jobs.c options.c parser.c \
+	redir.c trap.c var.c output.c
+	
+init.c: mkinit $(INIT_DEPS)
+	./mkinit $(INIT_DEPS)
+
+mkinit: mkinit.o
+mknodes: mknodes.o
+mksyntax: mksyntax.o
 
-LFLAGS= -8	# 8-bit lex scanner for arithmetic
-YFLAGS=	-d
-
-CPPFLAGS+=-DSHELL -I. -I${.CURDIR}
-
-.PATH:	${.CURDIR}/bltin ${.CURDIR}/../../usr.bin/printf ${.CURDIR}/../test
-
-CLEANFILES+= mkinit mknodes mksyntax
-CLEANFILES+= ${GENSRCS} y.tab.h
-
-token.h: mktokens
-	sh ${.ALLSRC}
-
-builtins.c builtins.h: mkbuiltins shell.h builtins.def
-	sh ${.ALLSRC} ${.OBJDIR}
-
-init.c: mkinit ${SHSRCS}
-	./${.ALLSRC}
+signames.c: mksignames
+	./mksignames
 
 nodes.c nodes.h: mknodes nodetypes nodes.c.pat
-	./${.ALLSRC}
+	./mknodes ./nodetypes ./nodes.c.pat
 
 syntax.c syntax.h: mksyntax
-	./${.ALLSRC}
-
-mkinit: mkinit.c
-	${HOST_LINK.c} -o mkinit ${.IMPSRC}
-
-mknodes: mknodes.c
-	${HOST_LINK.c} -o mknodes ${.IMPSRC}
+	./mksyntax
 
-.if	(${MACHINE_ARCH} == "powerpc") || \
-	(${MACHINE_ARCH} == "arm32") || \
-	(${MACHINE_ARCH} == "arm26")
-TARGET_CHARFLAG= -DTARGET_CHAR="u_int8_t"
-.else
-TARGET_CHARFLAG= -DTARGET_CHAR="int8_t"
-.endif
+arith.c arith.h: arith.y
+	yacc -d arith.y
+	mv y.tab.h arith.h
+	mv y.tab.c arith.c
 
-mksyntax: mksyntax.c
-	${HOST_LINK.c} ${TARGET_CHARFLAG} -o mksyntax ${.IMPSRC}
-
-.include <bsd.prog.mk>
+token.h: mktokens
+	sh ./mktokens
 
-${OBJS}: builtins.h nodes.h syntax.h token.h
+clean:
+	rm -f $(PROG) $(OBJS) $(CLEANFILES) core