Sign-correct ui-sdl-font.c; fix -V, -R
[clav.git] / Makefile
blob9399235a44cdecf2bd9965f036026a1132156e81
1 .SUFFIXES:
2 .SUFFIXES: .o .c
4 CFLAGS ?=
5 LDFLAGS ?=
7 PCSTATIC ?=
8 ifneq (,$(findstring -static,$(LDFLAGS)))
9 PCSTATIC += --static
10 endif
12 PREFIX ?= /usr
13 BINDIR ?= $(PREFIX)/bin
14 SHAREDIR ?= $(PREFIX)/share
15 MANDIR ?= $(PREFIX)/share/man
17 CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200809L
19 # Debug
20 # CFLAGS += -g -O0 -pedantic -Wall -Wextra -Werror
22 # If you plan to use clav-mutation-find, it is highly recommended that you enable -O3
23 # CFLAGS += -O3 -Wall -Wextra -Werror
25 SDLPROG = clav-sdl
26 TEXTPROG = clav-cli
27 MUTFINDPROG = clav-mutation-find
29 default: all
31 .PHONY: all
32 all: $(SDLPROG) $(TEXTPROG) $(MUTFINDPROG)
34 $(SDLPROG): clav.o quiver.o ui-sdl.o ui-sdl-font.o color-selection.o file-selection.o
35 $(CC) -o $@ $^ $(LDFLAGS) -lm $(shell pkg-config $(PCSTATIC) --libs sdl2 SDL2_ttf)
37 $(TEXTPROG): clav.o quiver.o ui-cli.o
38 $(CC) -o $@ $^ $(LDFLAGS)
40 $(MUTFINDPROG): mutation-finder.o quiver.o
41 $(CC) -o $@ $^ $(LDFLAGS)
43 clav.o: clav.c macros.h ui.h quiver.h
44 $(CC) $(CFLAGS) -c -o $@ $<
46 quiver.o: quiver.c macros.h ui.h quiver.h
47 $(CC) $(CFLAGS) -c -o $@ $<
49 ui-sdl.o: ui-sdl.c macros.h ui.h quiver.h color-selection.h file-selection.h ui-sdl-font.h
50 $(CC) $(CFLAGS) $(shell pkg-config $(PCSTATIC) --cflags sdl2 SDL2_ttf) -c -o $@ $<
52 ui-sdl-font.o: ui-sdl-font.c
53 $(CC) $(CFLAGS) -c -o $@ $<
55 ui-cli.o: ui-cli.c macros.h quiver.h
56 $(CC) $(CFLAGS) -c -o $@ $<
58 file-selection.o: file-selection.c file-selection.h macros.h
59 $(CC) $(CFLAGS) -c -o $@ $<
61 color-selection.o: color-selection.c color-selection.h macros.h
62 $(CC) $(CFLAGS) -c -o $@ $<
64 mutation-finder.o: mutation-finder.c macros.h quiver.h
65 $(CC) $(CFLAGS) -c -o $@ $<
67 .PHONY: clean
68 clean:
69 rm -f *.o
70 rm -f *~
71 rm -f $(SDLPROG)
72 rm -f $(TEXTPROG)
73 rm -f $(MUTFINDPROG)
75 .PHONY: install
76 install: all
77 mkdir -p $(DESTDIR)$(BINDIR)
78 cp -f $(SDLPROG) $(DESTDIR)$(BINDIR)/
79 cp -f $(TEXTPROG) $(DESTDIR)$(BINDIR)/
80 cp -f $(MUTFINDPROG) $(DESTDIR)$(BINDIR)/
81 mkdir -p $(DESTDIR)$(SHAREDIR)/clav
82 cp -f data/*.txt $(DESTDIR)$(SHAREDIR)/clav/
83 mkdir -p $(DESTDIR)$(MANDIR)/man1
84 cp -f clav.1 $(DESTDIR)$(MANDIR)/man1/
85 cp -f clav-cli.1 $(DESTDIR)$(MANDIR)/man1/
86 cp -f clav-sdl.1 $(DESTDIR)$(MANDIR)/man1/
87 cp -f clav-mutation-find.1 $(DESTDIR)$(MANDIR)/man1/
89 .PHONY: uninstall
90 uninstall:
91 cd $(DESTDIR)$(BINDIR) && rm -f $(SDLPROG)
92 cd $(DESTDIR)$(BINDIR) && rm -f $(TEXTPROG)
93 cd $(DESTDIR)$(BINDIR) && rm -f $(MUTFINDPROG)
94 cd $(DESTDIR)$(SHAREDIR) && rm -rf clav
95 cd $(DESTDIR)$(MANDIR)/man1 && rm -f clav.1 clav-mutation-find.1 clav-cli.1 clav-sdl.1