~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to tools/vtpm/Makefile

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
XEN_ROOT = ../..
 
2
 
 
3
# Base definitions and rules
 
4
include $(XEN_ROOT)/tools/vtpm/Rules.mk
 
5
 
 
6
# Dir name for emulator (as dom0 tpm driver)
 
7
TPM_EMULATOR_DIR = tpm_emulator
 
8
# Dir name for vtpm instance
 
9
VTPM_DIR = vtpm
 
10
ORIG_DIR = orig
 
11
 
 
12
# Emulator tarball name
 
13
TPM_EMULATOR_NAME = tpm_emulator-0.5.1
 
14
TPM_EMULATOR_TARFILE = $(TPM_EMULATOR_NAME).tar.gz
 
15
 
 
16
GMP_HEADER = /usr/include/gmp.h
 
17
 
 
18
.PHONY: all
 
19
all: build
 
20
 
 
21
.PHONY: build
 
22
build: build_sub
 
23
 
 
24
.PHONY: install
 
25
install: build
 
26
        $(MAKE) -C $(VTPM_DIR) $@
 
27
 
 
28
.PHONY: clean
 
29
clean:
 
30
        @if [ -d $(TPM_EMULATOR_DIR) ]; \
 
31
                then $(MAKE) -C $(TPM_EMULATOR_DIR) clean; \
 
32
        fi
 
33
        @if [ -d $(VTPM_DIR) ]; \
 
34
                then $(MAKE) -C $(VTPM_DIR) clean; \
 
35
        fi
 
36
 
 
37
.PHONY: mrproper
 
38
mrproper:
 
39
        rm -f $(TPM_EMULATOR_TARFILE) tpm_emulator.patch.old vtpm.patch.old
 
40
        rm -rf $(TPM_EMULATOR_DIR) $(VTPM_DIR) $(ORIG_DIR)
 
41
 
 
42
# Download Swiss emulator
 
43
$(TPM_EMULATOR_TARFILE):
 
44
        wget http://download.berlios.de/tpm-emulator/$(TPM_EMULATOR_TARFILE)
 
45
 
 
46
# Create vtpm dirs
 
47
$(VTPM_DIR)/tpmd/tpmd: $(TPM_EMULATOR_TARFILE) vtpm-0.5.1.patch
 
48
        rm -rf $(VTPM_DIR)
 
49
        tar -xzf $(TPM_EMULATOR_TARFILE)
 
50
        mv $(TPM_EMULATOR_NAME) $(VTPM_DIR)
 
51
 
 
52
        set -e; cd $(VTPM_DIR); \
 
53
        patch -p1 < ../vtpm-0.5.1.patch
 
54
 
 
55
orig: $(TPM_EMULATOR_TARFILE)
 
56
        mkdir $(ORIG_DIR);
 
57
        set -e; cd $(ORIG_DIR); \
 
58
        tar -xzf ../$(TPM_EMULATOR_TARFILE);
 
59
 
 
60
updatepatches: clean orig
 
61
        find $(VTPM_DIR) -name "*.orig" -print | xargs rm -f; 
 
62
        mv vtpm.patch vtpm.patch.old; 
 
63
        diff -uprN $(TPM_EMULATOR_DIR) $(VTPM_DIR) > vtpm.patch || true;
 
64
 
 
65
.PHONY: build_sub
 
66
build_sub: $(VTPM_DIR)/tpmd/tpmd
 
67
        set -e; if [ -e $(GMP_HEADER) ]; then \
 
68
                $(MAKE) -C $(VTPM_DIR); \
 
69
        else \
 
70
                echo "=== Unable to build VTPMs. libgmp could not be found."; \
 
71
        fi
 
72