forked from leo-arch/fnf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (47 loc) · 1.73 KB
/
Makefile
File metadata and controls
61 lines (47 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
CFLAGS+=-MD -Wall -Wextra -std=c99 -O3 -pedantic -Ideps -Werror=vla
PREFIX?=/usr/local
MANDIR?=$(PREFIX)/share/man
BINDIR?=$(PREFIX)/bin
DEBUGGER?=
ARFLAGS:=rcs
DOT_AARCH64?=0 # set to 1 for Cosmopolitan Libc build
INSTALL=install
INSTALL_PROGRAM=$(INSTALL)
INSTALL_DATA=${INSTALL} -m 644
LIBS=-lpthread
OBJECTS=src/fnf.o src/match.o src/tty.o src/choices.o src/options.o src/tty_interface.o src/colors.o src/selections.o src/keybindings.o
THEFTDEPS = deps/theft/theft.o deps/theft/theft_bloom.o deps/theft/theft_mt.o deps/theft/theft_hash.o
TESTOBJECTS=test/fnftest.c test/test_properties.c test/test_choices.c test/test_match.c src/match.o src/choices.o src/options.o src/tty_interface.o src/tty.o src/colors.o src/selections.o src/keybindings.o $(THEFTDEPS)
all: fnf
test/fnftest: $(TESTOBJECTS)
$(CC) $(CFLAGS) $(CCFLAGS) -Isrc -o $@ $(TESTOBJECTS) $(LIBS)
acceptance: fnf
cd test/acceptance && bundle --quiet && bundle exec ruby acceptance_test.rb
test: check
check: test/fnftest
$(DEBUGGER) ./test/fnftest
libfnf.a: $(OBJECTS)
$(AR) $(ARFLAGS) $@ $^
ifeq ($(DOT_AARCH64),1)
mkdir -p .aarch64
$(AR) $(ARFLAGS) .aarch64/$@ ./src/.aarch64/*.o
endif
fnf: libfnf.a
$(CC) $(CFLAGS) $(CCFLAGS) -o $@ consumer.c $(LIBS) -L./ -lfnf
install: fnf
mkdir -p $(DESTDIR)$(BINDIR)
cp fnf $(DESTDIR)$(BINDIR)/
chmod 755 ${DESTDIR}${BINDIR}/fnf
mkdir -p $(DESTDIR)$(MANDIR)/man1
cp fnf.1 $(DESTDIR)$(MANDIR)/man1/
chmod 644 ${DESTDIR}${MANDIR}/man1/fnf.1
uninstall:
rm -- $(DESTDIR)$(BINDIR)/fnf
rm -- $(DESTDIR)$(MANDIR)/man1/fnf.1
fmt:
clang-format -i src/*.c src/*.h
clean:
rm -f fnf *.a *.o *.d test/fnftest src/*.o src/*.d deps/*/*.o
rm -rf .aarch64 ./src/.aarch64
.PHONY: test check all clean install fmt acceptance
-include $(OBJECTS:.o=.d)