# Makefile.linux PROG= ash SRCS= alias.c arith.c arith_lex.c \ builtins.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 nodes.c options.c parser.c printf.c redir.c \ show.c syntax.c trap.c output.c var.c test.c kill.c OBJ1 = init.o OBJ2 = alias.o arith.o arith_lex.o \ builtins.o cd.o 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 nodes.o options.o parser.o printf.o redir.o \ show.o syntax.o trap.o output.o var.o test.o kill.o OBJS = $(OBJ1) $(OBJ2) YACC = bison -y LEX = flex -l SHELL_DEFS = -DSHELL -DSMALL SRC_DEFS = -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -D__BIT_TYPES_DEFINED__ OPTFLAGS = -g -O2 -pipe INCLUDES = -I. CFLAGS = $(SHELL_DEFS) $(SRC_DEFS) $(OPTFLAGS) $(INCLUDES) LDFLAGS = CLEANFILES =\ builtins.c builtins.h init.c mkinit mknodes mksyntax \ nodes.c nodes.h syntax.c syntax.h signames.c token.h \ arith.c arith.h arith_lex.c \ printf.c test.c echo.c kill.c all: $(OBJS) $(CC) -o $(PROG) $(OBJS) $(LDFLAGS) $(CC) -static -o $(PROG).static $(OBJS) $(LDFLAGS) install: all install -d $(DESTDIR)/bin install $(PROG) $(DESTDIR)/bin/$(PROG) install $(PROG).static $(DESTDIR)/bin/$(PROG).static install -d $(DESTDIR)/usr/share/man/man1 install -m 644 sh.1 $(DESTDIR)/usr/share/man/man1/ash.1 parser.o: token.h token.h: mktokens sh ./mktokens builtins.h builtins.c: mkbuiltins shell.h builtins.def sh ./mkbuiltins shell.h builtins.def . "$(CFLAGS)" init.c: mkinit $(SRCS) ./mkinit $(SRCS) touch init.c mkinit: mkinit.c $(CC) $(CFLAGS) $(LDFLAGS) mkinit.c -o $@ $(LDADD) nodes.c nodes.h: mknodes nodetypes nodes.c.pat ./mknodes nodetypes nodes.c.pat mknodes: mknodes.c $(CC) $(CFLAGS) $(LDFLAGS) mknodes.c -o $@ $(LDADD) syntax.c syntax.h: mksyntax ./mksyntax mksyntax: mksyntax.c parser.h $(CC) $(CFLAGS) $(LDFLAGS) mksyntax.c -o $@ $(LDADD) signames.c: mksignames ./mksignames echo.c: bltin/echo.c ln -s $< $@ test.c: bltin/test.c ln -s $< $@ kill.c: bltin/kill.c ln -s $< $@ printf.c: bltin/printf.c ln -s $< $@ arith.c: arith.y $(YACC) $< mv y.tab.c $@ arith_lex.o: arith_lex.c arith.h arith_yylex.o: arith_yylex.c arith.h arith_lex.c: arith_lex.l $(LEX) $< mv lex.yy.c $@ arith.h: arith.c sed -n '/^#define ARITH/p' $< > $@ clean: rm -f core $(CLEANFILES) $(PROG) $(PROG).static $(OBJS)