-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
36 lines (30 loc) · 820 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
name = stereowrap
linkname = lib$(name).so
soname = $(linkname).1
lib_so = $(soname).0
bin = $(name)
PREFIX=/usr/local
src = $(wildcard src/*.c)
obj = $(src:.c=.o)
CC = gcc
CFLAGS = -Wall -fPIC -g -D_GNU_SOURCE
LDFLAGS = -lGL -lpthread
$(lib_so): $(obj)
$(CC) -o $@ -shared -Wl,-soname,$(soname) $(obj) $(LDFLAGS)
.PHONY: clean
clean:
rm -f $(obj) $(lib_so)
.PHONY: install
install:
mkdir -p $(PREFIX)/bin $(PREFIX)/lib
cp $(lib_so) $(PREFIX)/lib/$(lib_so)
rm -f $(PREFIX)/lib/$(linkname) $(PREFIX)/lib/$(soname)
ln -s $(PREFIX)/lib/$(lib_so) $(PREFIX)/lib/$(soname)
ln -s $(PREFIX)/lib/$(soname) $(PREFIX)/lib/$(linkname)
cp $(bin) $(PREFIX)/bin/$(bin)
.PHONY: uninstall
uninstall:
rm -f $(PREFIX)/lib/$(soname)
rm -f $(PREFIX)/lib/$(lib_so)
rm -f $(PREFIX)/lib/$(linkname)
rm -f $(PREFIX)/bin/$(bin)