aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: ab48a9daeea14c9ca94e32d0438a51df5bbeaf34 (plain) (blame)
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
AS       := gcc
CXX      := g++
CXXFLAGS := -g -O0 -Wall -Wextra -I.
AR       := ar
RANLIB   := ranlib

lib/libmatcha.a: lib/matcha.o lib/thread_create.o lib/matcha.h
	$(AR) rcs $@ $(filter %.o,$^)
	$(RANLIB) $@

%.o: %.cc
	$(CXX) -c -o $@ $^ $(CXXFLAGS)

%.o: %.s
	$(AS) -c -o $@ $^

fmt:
	fd --type f '.+.h$$|.+.cc$$' --exec clang-format -i {}

example/test: example/test.o lib/libmatcha.a
	$(CXX) -o $@ $^

gdb: example/test
	which cgdb && cgdb -x util.gdb -ex 'start' example/test \
	           ||  gdb -x util.gdb -ex 'start' example/test

clean:
	rm -f example/test
	rm -f **/*.o **/lib*.a