summary refs log tree commit diff
path: root/bin/1sh/Makefile
blob: ad85a46a817fee43cea799167a2f060ed46f5a70 (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
PREFIX = /usr/local
MANDIR = $(PREFIX)/share/man

CFLAGS += -std=c99 -Wall -Wextra -DSHELL -Ilibedit
LDLIBS = -lcurses

-include config.mk

SRCS += alias.c
SRCS += arith_yacc.c
SRCS += arith_yylex.c
SRCS += cd.c
SRCS += echo.c
SRCS += error.c
SRCS += eval.c
SRCS += exec.c
SRCS += expand.c
SRCS += histedit.c
SRCS += input.c
SRCS += jobs.c
SRCS += kill.c
SRCS += mail.c
SRCS += main.c
SRCS += memalloc.c
SRCS += miscbltin.c
SRCS += mystring.c
SRCS += options.c
SRCS += output.c
SRCS += parser.c
SRCS += printf.c
SRCS += redir.c
SRCS += show.c
SRCS += test.c
SRCS += trap.c
SRCS += var.c

GENSRCS = builtins.c nodes.c syntax.c
GENHDRS = builtins.h nodes.h syntax.h token.h

SRCS += $(GENSRCS)
OBJS = $(SRCS:.c=.o) libedit/libedit.a

MAN1 = 1sh.1 1sh-kill.1 1sh-printf.1 1sh-test.1

all: tags 1sh

1sh: $(OBJS)
	$(CC) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@

$(OBJS): $(GENHDRS)

libedit/libedit.a:
	$(MAKE) -C libedit libedit.a

builtins.c builtins.h: mkbuiltins builtins.def
	sh mkbuiltins .

nodes.c nodes.h: mknodes nodetypes nodes.c.pat
	./mknodes nodetypes nodes.c.pat

syntax.c syntax.h: mksyntax
	./mksyntax

token.h: mktokens
	sh mktokens

tags: *.h *.c
	ctags -w *.h *.c

depend: $(SRCS) $(GENHDRS)
	$(CC) $(CFLAGS) -MM $(SRCS) > .depend

-include .depend

clean:
	rm -f 1sh $(OBJS) mknodes mksyntax $(GENSRCS) $(GENHDRS) tags .depend

install: 1sh $(MAN1)
	install -d $(PREFIX)/bin $(MANDIR)/man1
	install 1sh $(PREFIX)/bin
	install -m 644 $(MAN1) $(MANDIR)/man1

uninstall:
	rm -f $(PREFIX)/bin/1sh $(MAN1:%=$(MANDIR)/man1/%)

shell:
	grep -q '^$(PREFIX)/bin/1sh$$' /etc/shells \
		|| echo '$(PREFIX)/bin/1sh' >> /etc/shells

unshell:
	sed -i sed '\;^$(PREFIX)/bin/1sh$$;d' /etc/shells
:35:29 -0400'>2020-09-11Install mandoc on macOSJune McEnroe 2020-09-11Rewrite install script yet againJune McEnroe 2020-09-11Remove NetBSD from install scriptJune McEnroe I never use it. 2020-09-11Use MacPorts rather than pkgsrcJune McEnroe My system is probably such a mess now... 2020-09-11Add debian VM name to sshJune McEnroe 2020-09-11Add influencer tweetJune McEnroe 2020-09-10Add The Kingdom of GodsJune McEnroe Reading has really slowed down :( 2020-09-07Add SunglassesJune McEnroe An IRC find. 2020-09-06Add Between the BreathsJune McEnroe One of those good songs from a soundtrack of a film that probably isn't? The summary sounds a lot more interesting than the title implies, at least. 2020-09-04Open /dev/tty in nudgeJune McEnroe This makes it work even when it's run connected to a pipe, i.e. as the notify command of catgirl... 2020-09-04Add nudgeJune McEnroe 2020-09-03Build fbclock with -lzJune McEnroe I guess this got lost somewhere, long ago... 2020-08-29Add tweets from retweetsJune McEnroe