-
Notifications
You must be signed in to change notification settings - Fork 1
/
GNUmakefile
58 lines (44 loc) · 1.54 KB
/
GNUmakefile
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
PREFIX?= /usr/local
BINDIR?= $(PREFIX)/bin
MANDIR?= $(PREFIX)/man
DOCDIR?= $(PREFIX)/share/doc
CC?= gcc
UNAME:= $(shell sh -c 'uname 2> /dev/null || echo undefined')
CFLAGS+= -Iinclude -DFKEYS -DREGEX -DXKEYS
LDADD+= -lcurses
SRCS= autoexec.c basic.c bell.c buffer.c cinfo.c cmode.c cscope.c \
dir.c dired.c display.c echo.c extend.c file.c fileio.c \
funmap.c grep.c help.c kbd.c keymap.c line.c macro.c main.c \
match.c modes.c paragraph.c random.c region.c re_search.c \
search.c spawn.c tags.c theo.c tty.c ttyio.c ttykbd.c undo.c \
version.c window.c word.c yank.c
ifeq ($(UNAME), Linux)
LDADD+= -lcrypto
SRCS+= compat/arc4random.c compat/arc4random_uniform.c \
compat/explicit_bzero.c compat/fgetln.c compat/fparseln.c \
compat/getentropy_linux.c compat/reallocarray.c \
compat/strlcat.c compat/strlcpy.c compat/strtonum.c
else ifeq ($(UNAME), Darwin)
SRCS+= compat/fparseln.c compat/reallocarray.c compat/strtonum.c
endif
OBJS= $(SRCS:.c=.o)
all: mg
mg: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ $(LDADD)
%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
install: all
install -m 755 -d $(DESTDIR)$(BINDIR)
install -m 755 -d $(DESTDIR)$(MANDIR)/man1
install -m 755 -d $(DESTDIR)$(DOCDIR)/mg
install -m 755 mg $(DESTDIR)$(BINDIR)
install -m 644 mg.1 $(DESTDIR)$(MANDIR)/man1
install -m 644 tutorial $(DESTDIR)$(DOCDIR)/mg
install -m 644 README $(DESTDIR)$(DOCDIR)/mg
uninstall:
rm -f $(DESTDIR)$(BINDIR)/mg
rm -f $(DESTDIR)$(MANDIR)/man1/mg.1
rm -rf $(DESTDIR)$(DOCDIR)/mg
clean:
rm -f mg $(OBJS)
.PHONY: all install clean