-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
executable file
·44 lines (37 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
CC=gcc
CFLAGS=-c -Wall -Werror -fpic
LDFLAGS=-shared
LIBRARY=libi2c-com.so
VERSION=$(shell ./scripts/get_version)
prefix=/usr/lib
ifndef _COMMVERSION
_COMMVERSION:= $(shell git rev-list HEAD --count)
export _COMMVERSION
endif
ifndef _ARCH
_ARCH:= $(shell ./scripts/print_arch)
export _ARCH
endif
all: libi2c-com.o
$(CC) $(LDFLAGS) libi2c-com.o -o $(LIBRARY).$(VERSION)
libi2c-com.o: libi2c-com.c
$(CC) $(CFLAGS) libi2c-com.c -o libi2c-com.o
install:
install -m 0644 libi2c-com.so $(prefix)
ln -s
uninstall:
rm $(prefix)/libi2c-com.so
deb: all
mkdir -p package/usr/lib
mkdir -p package/usr/share/libi2c-com
cp -R examples package/usr/share/libi2c-com/
cp -R DEBIAN package/
chmod 666 package/usr/share/libi2c-com/examples/*
sed -i "s/#ARCH#/$(_ARCH)/" package/DEBIAN/control
sed -i "s/#COMMVERSION#/$(_COMMVERSION)/" package/DEBIAN/control
install -m 0644 $(LIBRARY).$(VERSION) package/usr/lib
ln -s $(LIBRARY).$(VERSION) package/usr/lib/$(LIBRARY)
dpkg-deb -b package libi2c-com_$(VERSION)_$(_ARCH).deb
clean:
rm -Rf *o *so* *.deb
rm -Rf package