summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: e647ae105deca8a124871cd1add9234cc219d232 (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
# $Id: Makefile,v 1.5 2008/05/21 20:22:44 mr_brain Exp $
#
# Simple makefile for the libk8055 library
#
# change this to your distribution default
# usually /usr/local or /usr
PREFIX = ?/usr/local
CC = gcc
EXEC = k8055
VERSION =0.4.1
BINDIR = $(PREFIX)/bin
LIBDIR = $(PREFIX)/lib
PYLIBDIR = pyk8055
INCLUDEDIR = $(PREFIX)/include
MANDIR = $(PREFIX)/man/man1
OBJS = main.o libk8055.o
CFLAGS = -O2 -DDAEMON -DVERSION='"$(VERSION)"' -Wall
LIBS = -lusb -L/usr/lib -lm
LINK = ln

libk8055.so.$(VERSION): libk8055.o
	$(CC) -o libk8055.so.${VERSION} $(LIBS) -shared libk8055.o
	-$(LINK) -sf libk8055.so.${VERSION} libk8055.so

libk8055.o: libk8055.c
	$(CC) $(CFLAGS) -c -g -fPIC libk8055.c

libk8055.a: libk8055.o
	ar rvs libk8055.a libk8055.o

libk8055.c: k8055.h

all: k8055_prog libk8055.so.${VERSION} libk8055.a

.PHONY: k8055_prog

k8055_prog: $(OBJS)
	$(CC) $(OBJS) -o $(EXEC) $(LIBS)
	# strip $(EXEC)

pylib: $(PYLIBDIR)/libk8055.i libk8055.c
	export VERSION=$(VERSION); $(MAKE) -C $(PYLIBDIR)

clean:	
	rm -f *.o libk8055.so libk8055.so.$(VERSION) $(EXEC) libk8055.a
	@$(MAKE) -C $(PYLIBDIR) clean

install: k8055_prog libk8055.so.$(VERSION)
	cp -f $(EXEC) $(BINDIR)/
	if !(test -d $(LIBDIR)); then \
	  mkdir -p $(LIBDIR); \
	fi
	if !(test -d $(INCLUDEDIR)); then \
	  mkdir -p $(INCLUDEDIR); \
	fi
	rm -f $(LIBDIR)/libk8055* 
	cp -Pf lib* $(LIBDIR)
	cp -f k8055.h $(INCLUDEDIR)
	if !(test -d $(MANDIR)); then \
	  mkdir -p $(MANDIR); \
	fi
	cp -f man/k8055.1.gz $(MANDIR)/

pyinstall: $(PYLIBDIR)/libk8055.i
	@$(MAKE) -C $(PYLIBDIR) install

uninstall:
	rm -f $(BINDIR)/$(EXEC) $(LIBDIR)/libk8055* $(INCLUDEDIR)/k8055.h

test: k8055_prog
	-@killall $(EXEC)
	./$(EXEC)