xref: /libCEED/Makefile (revision 582447c965eaf935db1b299bef20a33d4d429447)
1CFLAGS = -std=c99 -Wall -Wextra -Wno-unused-parameter -fPIC -MMD -MP
2CFLAGS += $(if $(NDEBUG),-O2,-g)
3CPPFLAGS = -I.
4LDLIBS = -lm
5
6libfeme := libfeme.so
7libfeme.c := $(wildcard feme*.c)
8tests.c   := $(sort $(wildcard t[0-9][0-9]-*.c))
9tests     := $(tests.c:%.c=%)
10
11$(libfeme) : $(libfeme.c:%.c=%.o)
12	$(CC) $(LDFLAGS) -shared -o $@ $^ $(LDLIBS)
13
14$(tests) : $(libfeme)
15$(tests) : LDFLAGS += -Wl,-rpath,. -L.
16t% : t%.c $(libfeme)
17
18run-t% : t%
19	@./tap.sh $<
20
21test : $(tests:%=run-%)
22
23.PHONY: clean print
24clean :
25	$(RM) *.o $(libfeme) $(tests.c:%.c=%)
26
27print :
28	@echo $(VAR)=$($(VAR))
29
30-include $(libfeme.c:%.c=%.d) $(tests.c:%.c=%.d)
31