blob: 28ade67d36906cf118fa966416be1d0ca17c7463 (
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
|
GFX ?= cocoa
PREFIX = ~/.local
BINS = brot gfxx
MAN1 = $(BINS:%=%.1)
CFLAGS += -Wall -Wextra -Wpedantic
LDLIBS = -lm -lz
LDLIBS_cocoa = -framework Cocoa
LDLIBS_x11 = -lX11
all: .gitignore tags $(BINS)
.gitignore: Makefile
echo '*.o' tags $(BINS) | tr ' ' '\n' > .gitignore
tags: *.h *.c
ctags -w *.h *.c
brot.o gfxx.o: gfx.h
cocoa.o fb.o x11.o: gfx.h
brot: brot.o $(GFX).o
$(CC) $(LDFLAGS) brot.o $(GFX).o $(LDLIBS) $(LDLIBS_$(GFX)) -o $@
gfxx: gfxx.o $(GFX).o
$(CC) $(LDFLAGS) gfxx.o $(GFX).o $(LDLIBS) $(LDLIBS_$(GFX)) -o $@
clean:
rm -f tags *.o $(BINS)
link:
mkdir -p $(PREFIX)/bin $(PREFIX)/share/man/man1
ln -s -f $(BINS:%=$(PWD)/%) $(PREFIX)/bin
ln -s -f $(MAN1:%=$(PWD)/%) $(PREFIX)/share/man/man1
unlink:
rm -f $(BINS:%=$(PREFIX)/bin/%)
rm -f $(MAN1:%=$(PREFIX)/share/man/man1/%)
|