7 PKG_CONFIG ?
= pkg-config
10 ifneq (,$(findstring -static
,$(LDFLAGS
)))
15 BINDIR ?
= $(PREFIX
)/bin
16 SHAREDIR ?
= $(PREFIX
)/share
17 MANDIR ?
= $(PREFIX
)/share
/man
19 CFLAGS
+= -std
=c99
-D_POSIX_C_SOURCE
=200809L
22 # CFLAGS += -fsanitize=address -g -O0 -pedantic -Wall -Wextra -Werror
23 # LDFLAGS += -fsanitize=address
25 # If you plan to use clav-mutation-find, it is highly recommended that you enable -O3
26 # CFLAGS += -O3 -Wall -Wextra -Werror
30 MUTFINDPROG
= clav-mutation-find
31 BFZIIIPROG
= clav-bfzIII
32 GRAPHISOPROG
= clav-check-graph-isomorphism
37 all: $(SDLPROG
) $(TEXTPROG
) $(MUTFINDPROG
) $(BFZIIIPROG
) $(GRAPHISOPROG
)
39 $(SDLPROG
): clav.o quiver.o ui-sdl.o ui-sdl-font.o color-selection.o file-selection.o
40 $(CC
) -o
$@
$^
$(LDFLAGS
) -lm
$(shell $(PKG_CONFIG
) $(PCSTATIC
) --libs sdl2 SDL2_ttf
)
42 $(TEXTPROG
): clav.o quiver.o ui-cli.o
43 $(CC
) -o
$@
$^
$(LDFLAGS
)
45 $(MUTFINDPROG
): mutation-finder.o quiver.o
46 $(CC
) -o
$@
$^
$(LDFLAGS
)
48 $(BFZIIIPROG
): bfzIII.o quiver.o
49 $(CC
) -o
$@
$^
$(LDFLAGS
)
51 $(GRAPHISOPROG
): check-graph-iso.o quiver.o
52 $(CC
) -o
$@
$^
$(LDFLAGS
)
54 clav.o
: clav.c macros.h ui.h quiver.h
55 $(CC
) $(CFLAGS
) -c
-o
$@
$<
57 quiver.o
: quiver.c macros.h ui.h quiver.h
58 $(CC
) $(CFLAGS
) -c
-o
$@
$<
60 ui-sdl.o
: ui-sdl.c macros.h ui.h quiver.h color-selection.h file-selection.h ui-sdl-font.h
61 $(CC
) $(CFLAGS
) $(shell $(PKG_CONFIG
) $(PCSTATIC
) --cflags sdl2 SDL2_ttf
) -c
-o
$@
$<
63 ui-sdl-font.o
: ui-sdl-font.c
64 $(CC
) $(CFLAGS
) -c
-o
$@
$<
66 ui-cli.o
: ui-cli.c macros.h quiver.h
67 $(CC
) $(CFLAGS
) -c
-o
$@
$<
69 file-selection.o
: file-selection.c file-selection.h macros.h
70 $(CC
) $(CFLAGS
) -c
-o
$@
$<
72 color-selection.o
: color-selection.c color-selection.h macros.h
73 $(CC
) $(CFLAGS
) -c
-o
$@
$<
75 mutation-finder.o
: mutation-finder.c macros.h quiver.h
76 $(CC
) $(CFLAGS
) -c
-o
$@
$<
78 bfzIII.o
: bfzIII.c macros.h quiver.h
79 $(CC
) $(CFLAGS
) -c
-o
$@
$<
81 check-graph-iso.o
: check-graph-iso.c macros.h quiver.h
82 $(CC
) $(CFLAGS
) -c
-o
$@
$<
96 mkdir
-p
$(DESTDIR
)$(BINDIR
)
97 cp
-f
$(SDLPROG
) $(DESTDIR
)$(BINDIR
)/
98 cp
-f
$(TEXTPROG
) $(DESTDIR
)$(BINDIR
)/
99 cp
-f
$(MUTFINDPROG
) $(DESTDIR
)$(BINDIR
)/
100 cp
-f
$(BFZIIIPROG
) $(DESTDIR
)$(BINDIR
)/
101 cp
-f
$(GRAPHISOPROG
) $(DESTDIR
)$(BINDIR
)/
102 mkdir
-p
$(DESTDIR
)$(SHAREDIR
)/clav
103 cp
-f data
/*.txt
$(DESTDIR
)$(SHAREDIR
)/clav
/
104 mkdir
-p
$(DESTDIR
)$(MANDIR
)/man1
105 cp
-f clav
.1 $(DESTDIR
)$(MANDIR
)/man1
/
106 cp
-f clav-cli
.1 $(DESTDIR
)$(MANDIR
)/man1
/
107 cp
-f clav-sdl
.1 $(DESTDIR
)$(MANDIR
)/man1
/
108 cp
-f clav-mutation-find
.1 $(DESTDIR
)$(MANDIR
)/man1
/
112 cd
$(DESTDIR
)$(BINDIR
) && rm -f
$(SDLPROG
)
113 cd
$(DESTDIR
)$(BINDIR
) && rm -f
$(TEXTPROG
)
114 cd
$(DESTDIR
)$(BINDIR
) && rm -f
$(MUTFINDPROG
)
115 cd
$(DESTDIR
)$(BINDIR
) && rm -f
$(BFZIIIPROG
)
116 cd
$(DESTDIR
)$(BINDIR
) && rm -f
$(GRAPHISOPROG
)
117 cd
$(DESTDIR
)$(SHAREDIR
) && rm -rf clav
118 cd
$(DESTDIR
)$(MANDIR
)/man1
&& rm -f clav
.1 clav-mutation-find
.1 clav-cli
.1 clav-sdl
.1