-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
47 lines (36 loc) · 782 Bytes
/
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
DEMO = termgl_demo
SO = libtermgl.so
HEADER = termgl.h
DEMO_SRC = termgl.c demo/termgl_demo.c
CFLAGS += -Wall
LDFLAGS += -lm
ifeq ($(OS),Windows_NT)
CC = cl
else
CFLAGS += -std=c99 -O3 -Wextra -Wpedantic
endif
lib%.so: %.pic.o
$(CC) $^ -shared -o $@ $(LDFLAGS)
%.pic.o: %.c
$(CC) -c $^ -o $@ $(CFLAGS) -fPIC
%.o: %.c
$(CC) -c $^ -o $@ $(CFLAGS)
# MSVC
%.obj: %.c
$(CC) -c $^ $(CFLAGS)
.PHONY: shared
shared: $(SO)
.PHONY: install
install: $(SO) $(HEADER)
cp $(SO) /usr/local/lib/$(SO)
cp $(HEADER) /usr/local/include/$(HEADER)
.PHONY: uninstall
uninstall:
rm -f /usr/local/lib/$(SO) /usr/local/include/$(HEADER)
.PHONY: demo
demo: $(DEMO)
$(DEMO): $(DEMO_SRC)
$(CC) $^ -o $@ $(CFLAGS) -DTERMGL3D -DTERMGLUTIL $(LDFLAGS)
.PHONY: clean
clean:
rm -f *.so *.o *.obj