| 1 | # Makefile for ash.
 | 
|---|
| 2 | 
 | 
|---|
| 3 | SRCS=   builtins.c cd.c dirent.c error.c eval.c exec.c expand.c input.c \
 | 
|---|
| 4 |         jobs.c mail.c main.c memalloc.c miscbltin.c mystring.c nodes.c \
 | 
|---|
| 5 |         options.c parser.c redir.c show.c signames.c syntax.c trap.c \
 | 
|---|
| 6 |         output.c var.c
 | 
|---|
| 7 | 
 | 
|---|
| 8 | OBJS=   builtins.o cd.o dirent.o error.o eval.o exec.o expand.o input.o \
 | 
|---|
| 9 |         jobs.o mail.o main.o memalloc.o miscbltin.o mystring.o nodes.o \
 | 
|---|
| 10 |         options.o parser.o redir.o show.o signames.o syntax.o trap.o \
 | 
|---|
| 11 |         output.o var.o init.o \
 | 
|---|
| 12 |         bltin/echo.o bltin/expr.o bltin/operators.o bltin/regexp.o
 | 
|---|
| 13 | 
 | 
|---|
| 14 | #
 | 
|---|
| 15 | # Set READLINE in shell.h and add -ledit to LIBS if you want to use the
 | 
|---|
| 16 | # editline package by Simmule Turner and Rich Salz.  (The big, bloated
 | 
|---|
| 17 | # and GPL contaminated FSF readline should work too.)
 | 
|---|
| 18 | #
 | 
|---|
| 19 | CPPFLAGS= -DSHELL -I. -D_MINIX -D_POSIX_SOURCE
 | 
|---|
| 20 | CFLAGS= -wo -i $(CPPFLAGS)
 | 
|---|
| 21 | LIBS=   -ledit
 | 
|---|
| 22 | CC = exec cc
 | 
|---|
| 23 | 
 | 
|---|
| 24 | CLEANFILES= $(OBJS) \
 | 
|---|
| 25 |         builtins.c builtins.h init.c mkinit mknodes mksignames mksyntax \
 | 
|---|
| 26 |         nodes.c nodes.h signames.c signames.h syntax.c syntax.h token.def \
 | 
|---|
| 27 |         bltin/operators.h bltin/operators.c
 | 
|---|
| 28 | 
 | 
|---|
| 29 | all:    sh
 | 
|---|
| 30 | 
 | 
|---|
| 31 | sh:     $(OBJS)
 | 
|---|
| 32 |         $(CC) $(CFLAGS) -o sh $(OBJS) $(LIBS)
 | 
|---|
| 33 |         install -S 100k sh
 | 
|---|
| 34 | 
 | 
|---|
| 35 | install:        /usr/bin/ash /usr/bin/sh /bin/sh /bin/bigsh
 | 
|---|
| 36 | 
 | 
|---|
| 37 | /usr/bin/ash:   sh
 | 
|---|
| 38 |         install -cs -o bin $? $@
 | 
|---|
| 39 | 
 | 
|---|
| 40 | /usr/bin/sh:    /usr/bin/ash
 | 
|---|
| 41 |         install -l $? $@
 | 
|---|
| 42 | 
 | 
|---|
| 43 | /bin/sh:        /usr/bin/ash
 | 
|---|
| 44 |         install -lcs $? $@
 | 
|---|
| 45 | 
 | 
|---|
| 46 | /bin/bigsh:     /usr/bin/ash
 | 
|---|
| 47 |         install -S 1500000 -lcs $? $@
 | 
|---|
| 48 | 
 | 
|---|
| 49 | clean:
 | 
|---|
| 50 |         rm -f $(CLEANFILES) sh core
 | 
|---|
| 51 | 
 | 
|---|
| 52 | parser.o: token.def
 | 
|---|
| 53 | 
 | 
|---|
| 54 | token.def: mktokens
 | 
|---|
| 55 |         sh mktokens
 | 
|---|
| 56 | 
 | 
|---|
| 57 | builtins.c builtins.h: builtins.table shell.h
 | 
|---|
| 58 |         sh mkbuiltins shell.h builtins.table
 | 
|---|
| 59 | 
 | 
|---|
| 60 | init.o: mkinit $(SRCS)
 | 
|---|
| 61 |         ./mkinit '$(CC) -c $(CFLAGS) init.c' $(SRCS)
 | 
|---|
| 62 | 
 | 
|---|
| 63 | mkinit: mkinit.c
 | 
|---|
| 64 |         $(CC) $(CFLAGS) mkinit.c -o $@
 | 
|---|
| 65 | 
 | 
|---|
| 66 | nodes.c nodes.h: mknodes nodetypes nodes.c.pat
 | 
|---|
| 67 |         ./mknodes nodetypes nodes.c.pat
 | 
|---|
| 68 | 
 | 
|---|
| 69 | mknodes: mknodes.c
 | 
|---|
| 70 |         $(CC) $(CFLAGS) mknodes.c -o $@
 | 
|---|
| 71 | 
 | 
|---|
| 72 | signames.c signames.h: mksignames
 | 
|---|
| 73 |         ./mksignames
 | 
|---|
| 74 | 
 | 
|---|
| 75 | mksignames: mksignames.c
 | 
|---|
| 76 |         $(CC) $(CFLAGS) mksignames.c -o $@
 | 
|---|
| 77 | 
 | 
|---|
| 78 | syntax.c syntax.h: mksyntax
 | 
|---|
| 79 |         ./mksyntax
 | 
|---|
| 80 | 
 | 
|---|
| 81 | mksyntax: mksyntax.c parser.h
 | 
|---|
| 82 |         $(CC) $(CFLAGS) mksyntax.c -o $@
 | 
|---|
| 83 | 
 | 
|---|
| 84 | bltin/operators.h:      bltin/mkexpr bltin/binary_op bltin/unary_op
 | 
|---|
| 85 |         cd bltin && sh mkexpr
 | 
|---|
| 86 | 
 | 
|---|
| 87 | bltin/echo.o:   bltin/echo.c
 | 
|---|
| 88 |         cd bltin && $(CC) -I.. $(CFLAGS) -c echo.c
 | 
|---|
| 89 | 
 | 
|---|
| 90 | bltin/expr.o:   bltin/expr.c
 | 
|---|
| 91 |         cd bltin && $(CC) -I.. $(CFLAGS) -c expr.c
 | 
|---|
| 92 | 
 | 
|---|
| 93 | bltin/operators.o:      bltin/operators.c
 | 
|---|
| 94 |         cd bltin && $(CC) -I.. $(CFLAGS) -c operators.c
 | 
|---|
| 95 | 
 | 
|---|
| 96 | bltin/regexp.o: bltin/regexp.c
 | 
|---|
| 97 |         cd bltin && $(CC) -I.. $(CFLAGS) -c regexp.c
 | 
|---|
| 98 | 
 | 
|---|
| 99 | # Dependencies you say?  This will have to do.
 | 
|---|
| 100 | $(OBJS): error.h eval.h exec.h expand.h init.h input.h \
 | 
|---|
| 101 |         jobs.h machdep.h mail.h main.h memalloc.h mystring.h options.h \
 | 
|---|
| 102 |         output.h parser.h redir.h shell.h trap.h var.h \
 | 
|---|
| 103 |         builtins.h nodes.h signames.h syntax.h
 | 
|---|
| 104 | 
 | 
|---|
| 105 | bltin/expr.o bltin/operators.o: bltin/operators.h
 | 
|---|