aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: e7e588d00da910ac80290c649b7851719c1e162d (plain) (blame)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
.POSIX:

CONFIGFILE = config.mk
include $(CONFIGFILE)

OS = linux
include mk/$(OS).mk


LIB_MAJOR = 1
LIB_MINOR = 0
LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR)
LIB_NAME = gammamm


LIBHDR =\
	libgamma.hh\
	libgamma-error.hh\
	libgamma-facade.hh\
	libgamma-method.hh

HDR =\
	$(LIBHDR)\
	libgamma-native.hh

OBJ =\
	libgamma-error.o\
	libgamma-facade.o\
	libgamma-method.o

LOBJ = $(OBJ:.o=.lo)


all: libgammamm.a libgammamm.$(LIBEXT)
$(OBJ): $(HDR)
$(LOBJ): $(HDR)
test.o: test.cc $(LIBHDR)

libgammamm.a: $(OBJ)
	@rm -f -- $@
	$(AR) rc $@ $(OBJ)

libgammamm.$(LIBEXT): $(LOBJ)
	$(CXX) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS)

test: test.o libgammamm.a
	$(CXX) -o $@ test.o libgammamm.a $(LDFLAGS)

.cc.o:
	$(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS)

.cc.lo:
	$(CXX) -fPIC -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS)

install: libgammamm.a libgammamm.$(LIBEXT)
	mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
	mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
	mkdir -p -- "$(DESTDIR)$(PKGCONFIGDIR)"
	cp -- libgammamm.pc "$(DESTDIR)$(PKGCONFIGDIR)"
	cp -- libgammamm.a "$(DESTDIR)$(PREFIX)/lib/"
	cp -- libgammamm.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libgammamm.$(LIBMINOREXT)"
	$(FIX_INSTALL_NAME) "$(DESTDIR)$(PREFIX)/lib/libgammamm.$(LIBMINOREXT)"
	ln -sf -- libgammamm.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libgammamm.$(LIBMAJOREXT)"
	ln -sf -- libgammamm.$(LIBMAJOREXT) "$(DESTDIR)$(PREFIX)/lib/libgammamm.$(LIBEXT)"
	cp -- $(LIBHDR) "$(DESTDIR)$(PREFIX)/include/"

uninstall:
	mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
	mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libgammamm.a"
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libgammamm.$(LIBMINOREXT)"
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libgammamm.$(LIBMAJOREXT)"
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libgammamm.$(LIBEXT)"
	-cd "$(DESTDIR)$(PREFIX)/include/" && rm -f -- $(LIBHDR)
	-rm -- "$(DESTDIR)$(PKGCONFIGDIR)/libgammamm.pc"

run-test:
	./test

clean:
	-rm -f -- *.su *.so *.so.* *.dll *.dylib *.$(LIBEXT) *.o *.lo test

.SUFFIXES:
.SUFFIXES: .lo .o .cc

.PHONY: all install uninstall check run-test clean