Remove .l suffix from Makefile
[clav.git] / Makefile
blob8b7b47947627d2a709cb27c83110d1e315f86f80
1 .SUFFIXES:
2 .SUFFIXES: .o .c
4 CFLAGS ?=
5 LDFLAGS ?=
7 PREFIX ?= /usr
8 BINDIR ?= $(PREFIX)/bin
9 SHAREDIR ?= $(PREFIX)/share
10 MANDIR ?= $(PREFIX)/share/man
12 CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200809L
14 # Debug
15 # CFLAGS += -g -O0 -pedantic -Wall -Wextra -Werror
17 # If you plan to use clav-flip-finder, it is highly recommended that you enable -O3
18 # CFLAGS += -O3 -Wall -Wextra -Werror
20 SDLPROG = clav-sdl
21 TEXTPROG = clav-cli
22 MUTFINDPROG = clav-mutation-find
24 SDL_FONT=\"/usr/share/fonts/dejavu/DejaVuSansMono.ttf\"
26 default: all
28 .PHONY: all
29 all: $(SDLPROG) $(TEXTPROG) $(MUTFINDPROG)
31 $(SDLPROG): clav.o quiver.o ui-sdl.o file-selection.o
32 $(CC) -o $@ $^ $(LDFLAGS) -lm $(shell pkg-config --libs sdl2 SDL2_ttf)
34 $(TEXTPROG): clav.o quiver.o ui-cli.o
35 $(CC) -o $@ $^ $(LDFLAGS)
37 $(MUTFINDPROG): mutation-finder.o quiver.o
38 $(CC) -o $@ $^ $(LDFLAGS)
40 clav.o: clav.c macros.h ui.h quiver.h
41 $(CC) $(CFLAGS) -c -o $@ $<
43 quiver.o: quiver.c macros.h ui.h quiver.h
44 $(CC) $(CFLAGS) -c -o $@ $<
46 ui-sdl.o: ui-sdl.c macros.h ui.h quiver.h
47 $(CC) $(CFLAGS) -DFONT_PATH=$(SDL_FONT) $(shell pkg-config --cflags sdl2 SDL2_ttf) -c -o $@ $<
49 ui-cli.o: ui-cli.c macros.h quiver.h
50 $(CC) $(CFLAGS) -c -o $@ $<
52 file-selection.o: file-selection.c file-selection.h macros.h
53 $(CC) $(CFLAGS) -c -o $@ $<
55 mutation-finder.o: mutation-finder.c macros.h quiver.h
56 $(CC) $(CFLAGS) -c -o $@ $<
58 .PHONY: clean
59 clean:
60 find -name '*.o' -delete
61 find -name '*~' -delete
62 rm -f $(SDLPROG)
63 rm -f $(TEXTPROG)
64 rm -f $(MUTFINDPROG)
66 .PHONY: install
67 install: all
68 mkdir -p $(DESTDIR)$(BINDIR)
69 cp -f $(SDLPROG) $(DESTDIR)$(BINDIR)/
70 cp -f $(TEXTPROG) $(DESTDIR)$(BINDIR)/
71 cp -f $(MUTFINDPROG) $(DESTDIR)$(BINDIR)/
72 mkdir -p $(DESTDIR)$(SHAREDIR)/clav
73 cp -f data/*.txt $(DESTDIR)$(SHAREDIR)/clav/
74 mkdir -p $(DESTDIR)$(MANDIR)/man1
75 cp -f clav.1 $(DESTDIR)$(MANDIR)/man1/
76 cp -f clav-cli.1 $(DESTDIR)$(MANDIR)/man1/
77 cp -f clav-sdl.1 $(DESTDIR)$(MANDIR)/man1/
78 cp -f clav-mutation-find.1 $(DESTDIR)$(MANDIR)/man1/
80 .PHONY: uninstall
81 uninstall:
82 cd $(DESTDIR)$(BINDIR) && rm -f $(SDLPROG)
83 cd $(DESTDIR)$(BINDIR) && rm -f $(TEXTPROG)
84 cd $(DESTDIR)$(BINDIR) && rm -f $(MUTFINDPROG)
85 cd $(DESTDIR)$(SHAREDIR) && rm -rf clav
86 cd $(DESTDIR)$(MANDIR)/man1 && rm -f clav.1 clav-mutation-find.1 clav-cli.1 clav-sdl.1