Fix arrow direction for vertical arrows
[clav.git] / Makefile
blob87aa2eb2d65af3cc0c216327972a72df38fa9838
1 .SUFFIXES:
2 .SUFFIXES: .o .c .l
4 CFLAGS ?=
5 LDFLAGS ?=
6 LFLAGS ?=
8 PREFIX ?= /usr
9 BINDIR ?= $(PREFIX)/bin
10 MANDIR ?= $(PREFIX)/share/man
12 CC ?= gcc
13 CFLAGS += -std=c99 -D_XOPEN_SOURCE
14 LD ?= gcc
16 # Debug
17 CFLAGS += -g -O0 -pedantic -Wall -Wextra -Werror
19 SDLPROG = clav-sdl
20 TEXTPROG = clav-cli
22 SDL_FONT=\"/usr/share/fonts/dejavu/DejaVuSansMono.ttf\"
24 MAN = clav.1
26 default: all
28 .PHONY: all
29 all: $(SDLPROG) $(TEXTPROG)
31 sdl2: $(SDLPROG)
32 cli: $(TEXTPROG)
34 clav.o: clav.c macros.h ui.h quiver.h
35 $(CC) $(CFLAGS) -c -o $@ $<
37 quiver.o: quiver.c macros.h ui.h quiver.h
38 $(CC) $(CFLAGS) -c -o $@ $<
40 $(SDLPROG): clav.o quiver.o ui-sdl.o
41 $(LD) $(LDFLAGS) -lm $(shell pkg-config --libs sdl2 SDL2_ttf) -o $@ $^
43 $(TEXTPROG): clav.o quiver.o ui-cli.o
44 $(LD) $(LDFLAGS) -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
50 $(CC) $(CFLAGS) -c -o $@ $<
52 .PHONY: clean
53 clean:
54 find -name '*.o' -delete
55 find -name '*~' -delete
56 rm -f $(SDLPROG)
58 .PHONY: install
59 install: all
60 mkdir -p $(DESTDIR)$(BINDIR)
61 cp -f $(SDLPROG) $(DESTDIR)$(BINDIR)/
62 mkdir -p $(DESTDIR)$(MANDIR)/man1
63 cp -f $(MAN) $(DESTDIR)$(MANDIR)/man1/
65 .PHONY: uninstall
66 uninstall:
67 cd $(DESTDIR)$(BINDIR) && rm -f $(SDLPROG)
68 cd $(DESTDIR)$(MANDIR)/man1 && rm -f $(MAN)