-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
59 lines (49 loc) · 1.06 KB
/
Makefile
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
cc = cc
CFLAGS = -std=c99 -O3 -Wall
LDFLAGS = -lpthread
NAME = libspinner
UNAME_S = $(shell uname -s)
# respect traditional UNIX path usage
INCDIR = /usr/local/include
LIBDIR = /usr/local/lib
ifeq ($(UNAME_S),Darwin)
$(NAME).dylib: clean
$(CC) -c -dynamiclib -o $@ $(CFLAGS) $(LDFLAGS)
endif
ifeq ($(UNAME_S),Linux)
$(NAME).so: clean
$(CC) -shared -o $@ $(CFLAGS) $(LDFLAGS)
endif
.PHONY: install
install:
cp spinner.h $(INCDIR)
ifeq ($(UNAME_S),Linux)
cp spinner.h $(INCDIR)
cp $(NAME).so $(LIBDIR)
endif
ifeq ($(UNAME_S),Darwin)
cp spinner.h $(INCDIR)
cp $(NAME).dylib $(LIBDIR)
endif
uninstall:
rm -f $(INCDIR)/spinner.h
ifeq ($(UNAME_S),Linux)
rm -f $(INCDIR)/$(NAME).so
endif
ifeq ($(UNAME_S),Darwin)
rm -f $(INCDIR)/$(NAME).dylib
endif
.PHONY: test
test: clean
$(CC) -o tests/tests spinner.c tests/tests.c tests/unity/unity.c $(LDFLAGS)
tests/tests
rm -f tests/tests
.PHONY: clean
clean:
rm -f $(NAME).dylib
rm -f $(NAME).so
rm -f example
rm -f tests/tests
.PHONY: example
example: clean
$(CC) -o $@ spinner.c example.c $(CFLAGS) $(LDFLAGS)