~ubuntu-branches/ubuntu/trusty/drbd8/trusty

« back to all changes in this revision

Viewing changes to drbd/Makefile

  • Committer: Bazaar Package Importer
  • Author(s): Andres Rodriguez
  • Date: 2011-07-05 15:40:13 UTC
  • mfrom: (1.4.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20110705154013-f9l32owj6mi9e1p0
Tags: 2:8.3.11-0ubuntu1
* New upstream release
* debian/patches/01_ubuntu_cn_idx.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
# Lets test on PATCHLEVEL, that won't change too soon...
37
37
 
38
38
ifneq ($(PATCHLEVEL),)
 
39
 ifneq ($(VERSION),3)
39
40
  ifneq ($(VERSION),2)
40
41
    $(error "won't compile with this kernel version")
41
42
  endif
42
43
  ifneq ($(PATCHLEVEL),6)
43
44
    $(error "won't compile with this kernel version")
44
45
  endif
 
46
 endif
45
47
 
46
48
  CONFIG_BLK_DEV_DRBD := m
47
 
  CONFIG_DRBD_TRACE := $(shell test $${SUBLEVEL} -ge 30 && echo m || echo n)
48
 
 
49
 
  include $(DRBDSRC)/Makefile-2.6
50
 
 
51
 
  override EXTRA_CFLAGS += -I$(DRBDSRC)
 
49
  CONFIG_DRBD_TRACE := n
 
50
 
 
51
  include $(src)/Makefile-2.6
 
52
 
52
53
  # remember KERNELRELEASE for install target
53
54
  # .kernelversion can be included in Makefile as well as
54
55
  # sourced from shell
59
60
                  "LOCALVERSION=$(LOCALVERSION)\n"   \
60
61
                  "KERNELRELEASE=$(KERNELRELEASE)\n" \
61
62
                  "KERNELVERSION=$(KERNELVERSION)"   \
62
 
          > $(DRBDSRC)/.drbd_kernelrelease.new       \
 
63
          > $(src)/.drbd_kernelrelease.new       \
63
64
   )
64
65
else
65
66
  # called from command line in current directory
69
70
  SHELL=/bin/bash
70
71
 
71
72
  DRBDSRC := $(shell pwd)
72
 
  export DRBDSRC
73
73
 
74
74
  # to be overridden on command line:
75
75
  PREFIX := /
114
114
.PHONY: drbd_buildtag.c
115
115
 
116
116
  drbd_buildtag.c:
117
 
        @is_tarball=`test -e ../.git/. && echo false || echo true`;\
118
 
        set -e; exec > $@.new;                                                  \
 
117
        @set -e; exec > $@.new;                                                 \
119
118
        echo -e "/* automatically generated. DO NOT EDIT. */";                  \
120
119
        echo -e "#include <linux/drbd.h>";                                      \
121
120
        echo -e "const char *drbd_buildtag(void)\n{";                           \
122
 
        if $$is_tarball; then                                                   \
123
 
          if ! test -e $@ ; then                                                \
124
 
                echo >&2 "your DRBD source tree is broken. unpack again.";      \
 
121
        if test -e ../.git && GITHEAD=$$(git rev-parse HEAD); then              \
 
122
                GITDIFF=$$(cd .. && git diff --name-only HEAD |                 \
 
123
                        tr -s '\t\n' '  ' |                                     \
 
124
                        sed -e 's/^/ /;s/ *$$//');                              \
 
125
                echo -e "\treturn \"GIT-hash: $$GITHEAD$$GITDIFF\"";            \
 
126
        elif ! test -e $@ ; then                                                \
 
127
                echo >&2 "$@ not found.";                                       \
 
128
                test -e ../.git &&                                              \
 
129
                >&2 printf "%s\n"                                               \
 
130
                        "git did not work, but this looks like a git checkout?" \
 
131
                        "Install git and try again." ||                         \
 
132
                echo >&2 "Your DRBD source tree is broken. Unpack again.";      \
125
133
                exit 1;                                                         \
126
 
          fi;                                                                   \
127
 
          grep return $@ ;                                                      \
128
134
        else                                                                    \
129
 
          GITHEAD=$$(git rev-parse HEAD);                                       \
130
 
          GITDIFF=$$(cd .. && git diff --name-only HEAD | tr -s '\t\n' '  ' |   \
131
 
                sed -e 's/^/ /;s/ *$$//');                                      \
132
 
          echo -e "\treturn \"GIT-hash: $$GITHEAD$$GITDIFF\"";                  \
 
135
                grep return $@ ;                                                \
133
136
        fi ;                                                                    \
134
137
        echo -e "\t\t\" build by $$USER@$$HOSTNAME, `date "+%F %T"`\";\n}";     \
135
138
        mv --force $@.new $@
137
140
  kbuild: drbd_buildtag.c
138
141
        @rm -f .drbd_kernelrelease*
139
142
        -test -f ../scripts/adjust_drbd_config_h.sh && \
140
 
         KDIR=$(KDIR) O=$(O) $(SHELL) ../scripts/adjust_drbd_config_h.sh
 
143
                KDIR=$(KDIR) O=$(O) $(SHELL) ../scripts/adjust_drbd_config_h.sh
141
144
    # previous to 2.6.6 (suse: 2.6.5-dunno), this should be:
142
145
        $(MAKE) -C $(KDIR)  $(if $(O),O=$(O),) SUBDIRS=$(DRBDSRC) $(ARCH_UM) modules
143
146
# $(MAKE) -C $(KDIR) M=$(DRBDSRC) $(ARCH_UM) modules
179
182
    # for VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION, KERNELRELEASE
180
183
    include .drbd_kernelrelease
181
184
    MODOBJ := drbd.ko
182
 
    MODSUBDIR := kernel/drivers/block
 
185
    MODSUBDIR := updates
183
186
    LINUX := $(wildcard /lib/modules/$(KERNELRELEASE)/build)
184
187
 
185
188
    install: