Add clav-check-graph-isomorphism
[clav.git] / Makefile
blob0d8b4c2717afcf43627629bc949f3a1662ad2b17
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
28 BFZIIIPROG = clav-bfzIII
29 GRAPHISOPROG = clav-check-graph-isomorphism
31 default: all
33 .PHONY: all
34 all: $(SDLPROG) $(TEXTPROG) $(MUTFINDPROG) $(BFZIIIPROG) $(GRAPHISOPROG)
36 $(SDLPROG): clav.o quiver.o ui-sdl.o ui-sdl-font.o color-selection.o file-selection.o
37 $(CC) -o $@ $^ $(LDFLAGS) -lm $(shell pkg-config $(PCSTATIC) --libs sdl2 SDL2_ttf)
39 $(TEXTPROG): clav.o quiver.o ui-cli.o
40 $(CC) -o $@ $^ $(LDFLAGS)
42 $(MUTFINDPROG): mutation-finder.o quiver.o
43 $(CC) -o $@ $^ $(LDFLAGS)
45 $(BFZIIIPROG): bfzIII.o quiver.o
46 $(CC) -o $@ $^ $(LDFLAGS)
48 $(GRAPHISOPROG): check-graph-iso.o quiver.o
49 $(CC) -o $@ $^ $(LDFLAGS)
51 clav.o: clav.c macros.h ui.h quiver.h
52 $(CC) $(CFLAGS) -c -o $@ $<
54 quiver.o: quiver.c macros.h ui.h quiver.h
55 $(CC) $(CFLAGS) -c -o $@ $<
57 ui-sdl.o: ui-sdl.c macros.h ui.h quiver.h color-selection.h file-selection.h ui-sdl-font.h
58 $(CC) $(CFLAGS) $(shell pkg-config $(PCSTATIC) --cflags sdl2 SDL2_ttf) -c -o $@ $<
60 ui-sdl-font.o: ui-sdl-font.c
61 $(CC) $(CFLAGS) -c -o $@ $<
63 ui-cli.o: ui-cli.c macros.h quiver.h
64 $(CC) $(CFLAGS) -c -o $@ $<
66 file-selection.o: file-selection.c file-selection.h macros.h
67 $(CC) $(CFLAGS) -c -o $@ $<
69 color-selection.o: color-selection.c color-selection.h macros.h
70 $(CC) $(CFLAGS) -c -o $@ $<
72 mutation-finder.o: mutation-finder.c macros.h quiver.h
73 $(CC) $(CFLAGS) -c -o $@ $<
75 bfzIII.o: bfzIII.c macros.h quiver.h
76 $(CC) $(CFLAGS) -c -o $@ $<
78 check-graph-iso.o: check-graph-iso.c macros.h quiver.h
79 $(CC) $(CFLAGS) -c -o $@ $<
81 .PHONY: clean
82 clean:
83 rm -f *.o
84 rm -f *~
85 rm -f $(SDLPROG)
86 rm -f $(TEXTPROG)
87 rm -f $(MUTFINDPROG)
88 rm -f $(BFZIIIPROG)
89 rm -f $(GRAPHISOPROG)
91 .PHONY: install
92 install: all
93 mkdir -p $(DESTDIR)$(BINDIR)
94 cp -f $(SDLPROG) $(DESTDIR)$(BINDIR)/
95 cp -f $(TEXTPROG) $(DESTDIR)$(BINDIR)/
96 cp -f $(MUTFINDPROG) $(DESTDIR)$(BINDIR)/
97 cp -f $(BFZIIIPROG) $(DESTDIR)$(BINDIR)/
98 cp -f $(GRAPHISOPROG) $(DESTDIR)$(BINDIR)/
99 mkdir -p $(DESTDIR)$(SHAREDIR)/clav
100 cp -f data/*.txt $(DESTDIR)$(SHAREDIR)/clav/
101 mkdir -p $(DESTDIR)$(MANDIR)/man1
102 cp -f clav.1 $(DESTDIR)$(MANDIR)/man1/
103 cp -f clav-cli.1 $(DESTDIR)$(MANDIR)/man1/
104 cp -f clav-sdl.1 $(DESTDIR)$(MANDIR)/man1/
105 cp -f clav-mutation-find.1 $(DESTDIR)$(MANDIR)/man1/
107 .PHONY: uninstall
108 uninstall:
109 cd $(DESTDIR)$(BINDIR) && rm -f $(SDLPROG)
110 cd $(DESTDIR)$(BINDIR) && rm -f $(TEXTPROG)
111 cd $(DESTDIR)$(BINDIR) && rm -f $(MUTFINDPROG)
112 cd $(DESTDIR)$(BINDIR) && rm -f $(BFZIIIPROG)
113 cd $(DESTDIR)$(BINDIR) && rm -f $(GRAPHISOPROG)
114 cd $(DESTDIR)$(SHAREDIR) && rm -rf clav
115 cd $(DESTDIR)$(MANDIR)/man1 && rm -f clav.1 clav-mutation-find.1 clav-cli.1 clav-sdl.1