~ubuntu-branches/ubuntu/trusty/libdogleg/trusty

« back to all changes in this revision

Viewing changes to .pc/0001-manpage-no-longer-has-date-for-multi-arch.patch/Makefile

  • Committer: Package Import Robot
  • Author(s): Dima Kogan
  • Date: 2014-01-12 23:18:46 UTC
  • mfrom: (2.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20140112231846-y135oovkemjkghrp
Tags: 0.08-2
* libdogleg is now Priority: optional
* libdogleg is now Multi-arch:same

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
API_VERSION = 2
 
2
 
 
3
OS = $(shell uname -s)
 
4
 
 
5
# I parse the version from the changelog. This version is generally something
 
6
# like 0.04-1 Here 0.04 is the main version and 1 is the debian package
 
7
# version. I only use the main version and strip leading 0s, so the above
 
8
# becomes 0.4
 
9
VERSION := $(shell sed -n 's/.*(\([0-9\.]*[0-9]\).*).*/\1/; s/\.0*/./g; p; q;' Changes)
 
10
 
 
11
ifeq ($(strip $(VERSION)),)
 
12
$(error "Couldn't parse version from debian/changelog")
 
13
endif
 
14
 
 
15
ifeq ($(OS),Darwin)
 
16
        CC = gcc # otherwise, CC defaults to clang
 
17
        SO_VERSION=$(API_VERSION).$(VERSION)
 
18
        TARGET_SO_BARE   = libdogleg.dylib
 
19
        TARGET_SO_FULL   = libdogleg.$(SO_VERSION).dylib
 
20
        TARGET_SO_SONAME = libdogleg.$(API_VERSION).dylib
 
21
 
 
22
# osx doesn't have DT_NEEDED or something, so I specify these explicitly
 
23
        LDLIBS += -lsuitesparseconfig -lamd -lcolamd -llapack -lblas
 
24
else
 
25
        SO_VERSION=$(API_VERSION).$(VERSION)
 
26
        TARGET_SO_BARE   = libdogleg.so
 
27
        TARGET_SO_FULL   = $(TARGET_SO_BARE).$(SO_VERSION)
 
28
        TARGET_SO_SONAME = $(TARGET_SO_BARE).$(API_VERSION)
 
29
        LDFLAGS += -Wl,-soname -Wl,libdogleg.so.$(API_VERSION)
 
30
endif
 
31
 
 
32
# Add my optimization flags if none already exist. These could exist if debian
 
33
# packages are built.
 
34
OPTFLAGS := $(if $(filter -O%, $(CFLAGS)),,-O3 -ffast-math -mtune=core2)
 
35
 
 
36
FLAGS += -ggdb  -Wall -Wextra -MMD $(OPTFLAGS) -I/usr/include/suitesparse
 
37
CFLAGS += $(FLAGS) --std=gnu99
 
38
 
 
39
LDLIBS += -lcholmod
 
40
LDLIBS += -lm
 
41
 
 
42
LIB_TARGETS = libdogleg.a $(TARGET_SO_BARE) $(TARGET_SO_FULL) $(TARGET_SO_SONAME)
 
43
 
 
44
MAN_SECTION = 3
 
45
MAN_TARGET = libdogleg.$(MAN_SECTION)
 
46
 
 
47
ALL_TARGETS = $(LIB_TARGETS) $(MAN_TARGET)
 
48
 
 
49
all: $(ALL_TARGETS)
 
50
 
 
51
libdogleg.a: dogleg.o
 
52
        ar rcvu $@ $^
 
53
 
 
54
$(TARGET_SO_FULL): dogleg-pic.o
 
55
        $(CC) $(LDFLAGS) -shared $^ $(LDLIBS) -o $@
 
56
 
 
57
$(TARGET_SO_SONAME) $(TARGET_SO_BARE): $(TARGET_SO_FULL)
 
58
        ln -fs $^ $@
 
59
 
 
60
%-pic.o: %.c
 
61
        $(CC) $(CPPFLAGS) -fPIC $(CFLAGS) -c -o $@ $<
 
62
 
 
63
$(MAN_TARGET): README.pod
 
64
        pod2man --center="libdogleg: Powell's dogleg method" --name=LIBDOGLEG --release="libdogleg $(VERSION)" --section=$(MAN_SECTION) $^ $@
 
65
 
 
66
 
 
67
sample: sample.o libdogleg.a
 
68
        $(CC) $^ $(LDLIBS) -o $@
 
69
 
 
70
sample.o: CFLAGS += -I.
 
71
 
 
72
clean:
 
73
        rm -f libdogleg.so* *.o *.a *.d $(ALL_TARGETS)
 
74
 
 
75
.PHONY: all clean
 
76
 
 
77
-include *.d