~ubuntu-branches/debian/stretch/uswsusp/stretch

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-08-11 09:42:59 UTC
  • Revision ID: james.westby@ubuntu.com-20060811094259-xbpx53fo39c0xl8y
Tags: 0.1
Initial Release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
CONFIG_COMPRESS=yes
 
2
#CONFIG_ENCRYPT=yes
 
3
 
 
4
ARCH:=$(shell uname -m)
 
5
 
 
6
CC_FLAGS=-g -I/usr/local/include
 
7
LD_FLAGS=-L/usr/local/lib
 
8
 
 
9
ifdef CONFIG_COMPRESS
 
10
CC_FLAGS        += -Ilzf -DCONFIG_COMPRESS
 
11
LD_FLAGS        += -Llzf -llzf
 
12
endif
 
13
ifdef CONFIG_ENCRYPT
 
14
GCRYPT_CC_FLAGS := $(shell libgcrypt-config --cflags)
 
15
GCRYPT_LD_FLAGS := $(shell libgcrypt-config --libs)
 
16
CC_FLAGS        += -DCONFIG_ENCRYPT
 
17
CC_FLAGS        += $(GCRYPT_CC_FLAGS)
 
18
LD_FLAGS        += $(GCRYPT_LD_FLAGS)
 
19
endif
 
20
 
 
21
SUSPEND_DIR=/usr/local/sbin
 
22
CONFIG_DIR=/etc
 
23
RESUME_DEVICE=<path_to_resume_device_file>
 
24
BOOT_DIR=/boot
 
25
 
 
26
S2DISK=s2disk
 
27
CONFIGFILE=suspend.conf
 
28
 
 
29
ifdef CONFIG_ENCRYPT
 
30
all: $(S2DISK) suspend-keygen resume
 
31
else
 
32
all: lzf $(S2DISK) resume
 
33
endif
 
34
 
 
35
clean:
 
36
        rm -f $(S2DISK) suspend-keygen suspend.keys resume s2ram *.o lzf/*.o lzf/*.a 
 
37
 
 
38
s2ram:  s2ram.c dmidecode.c whitelist.c radeontool.c $(S2RAMOBJ)
 
39
        $(CC) -g -Wall -O2 s2ram.c $(S2RAMOBJ) -lpci -o s2ram
 
40
 
 
41
vbetool/vbetool.o:      vbetool/vbetool.c
 
42
        $(CC) -Wall -O2 -DS2RAM -c vbetool/vbetool.c -o vbetool/vbetool.o
 
43
 
 
44
vbetool/lrmi.o: vbetool/lrmi.c
 
45
        $(CC) -Wall -O2 -c vbetool/lrmi.c -o vbetool/lrmi.o
 
46
 
 
47
vbetool/x86-common.o:   vbetool/x86-common.c
 
48
        $(CC) -Wall -O2 -c vbetool/x86-common.c -o vbetool/x86-common.o
 
49
 
 
50
vbetool/x86emu/libx86emu.a:
 
51
        make -C vbetool/x86emu -f makefile.linux
 
52
 
 
53
vbetool/thunk.o:        vbetool/thunk.c
 
54
        $(CC) -Wall -O2 -c vbetool/thunk.c -o vbetool/thunk.o
 
55
 
 
56
dmidecode.o:    dmidecode.c
 
57
        $(CC) -Wall -O2 -DS2RAM -c dmidecode.c -o dmidecode.o
 
58
 
 
59
radeontool.o:   radeontool.c
 
60
        $(CC) -Wall -O2 -DS2RAM -c radeontool.c -o radeontool.o
 
61
 
 
62
md5.o:  md5.c md5.h
 
63
        $(CC) -Wall -o md5.o -DHAVE_INTTYPES_H -DHAVE_STDINT_H -c md5.c
 
64
 
 
65
encrypt.o:      encrypt.c encrypt.h md5.h
 
66
        $(CC) -Wall -DHAVE_INTTYPES_H -DHAVE_STDINT_H $(CC_FLAGS) -c encrypt.c
 
67
 
 
68
config.o:       config.c config.h
 
69
        $(CC) -Wall $(CC_FLAGS) -c config.c
 
70
 
 
71
vt.o:   vt.c vt.h
 
72
        $(CC) -Wall -c vt.c
 
73
 
 
74
lzf/liblzf.a:
 
75
        make -C lzf
 
76
 
 
77
$(S2DISK):      lzf/liblzf.a vt.o md5.o encrypt.o config.o suspend.c swsusp.h config.h encrypt.h md5.h $(SPLASHOBJ)
 
78
        $(CC) -g -O2 -Wall $(CC_FLAGS) vt.o md5.o encrypt.o config.o suspend.c -o $@ $(SPLASHOBJ) $(LD_FLAGS)
 
79
 
 
80
$(S2BOTH):      md5.o encrypt.o config.o suspend.c swsusp.h config.h encrypt.h md5.h s2ram.c dmidecode.c whitelist.c radeontool.c $(S2RAMOBJ) $(SPLASHOBJ)
 
81
        $(CC) -g -O2 -DCONFIG_BOTH -Wall $(CC_FLAGS) md5.o encrypt.o config.o suspend.c s2ram.c -o $@ $(S2RAMOBJ) $(SPLASHOBJ) $(LD_FLAGS) -lpci
 
82
 
 
83
resume: md5.o encrypt.o config.o resume.c swsusp.h config.h encrypt.h md5.h $(SPLASHOBJ)
 
84
        $(CC) -Wall $(CC_FLAGS) md5.o encrypt.o config.o vt.o resume.c $(SPLASHOBJ) -o resume $(LD_FLAGS)
 
85
 
 
86
ifdef CONFIG_ENCRYPT
 
87
suspend-keygen: md5.o keygen.c encrypt.h md5.h
 
88
        $(CC) -Wall -DHAVE_INTTYPES_H -DHAVE_STDINT_H $(CC_FLAGS) md5.o keygen.c -o suspend-keygen $(LD_FLAGS)
 
89
 
 
90
install-s2disk: $(S2DISK) suspend-keygen conf/$(CONFIGFILE)
 
91
        if [ ! -c /dev/snapshot ]; then mknod /dev/snapshot c 10 231; fi
 
92
        install --mode=755 suspend-keygen $(DESTDIR)$(SUSPEND_DIR)
 
93
        install --mode=755 $(S2DISK) $(DESTDIR)$(SUSPEND_DIR)
 
94
        if [ -f $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE) ]; then install --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE).new; else install --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR); fi
 
95
 
 
96
install-suspend: $(S2DISK) $(S2BOTH) suspend-keygen conf/$(CONFIGFILE)
 
97
        if [ ! -c /dev/snapshot ]; then mknod /dev/snapshot c 10 231; fi
 
98
        install --mode=755 suspend-keygen $(DESTDIR)$(SUSPEND_DIR)
 
99
        install --mode=755 $(S2DISK) $(DESTDIR)$(SUSPEND_DIR)
 
100
        install --mode=755 $(S2BOTH) $(DESTDIR)$(SUSPEND_DIR)
 
101
        if [ -f $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE) ]; then install --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE).new; else install --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR); fi
 
102
        install --mode=755 s2ram $(DESTDIR)$(SUSPEND_DIR)
 
103
else
 
104
install-s2disk: $(S2DISK) conf/$(CONFIGFILE)
 
105
        if [ ! -c /dev/snapshot ]; then mknod /dev/snapshot c 10 231; fi
 
106
        install --mode=755 $(S2DISK) $(DESTDIR)$(SUSPEND_DIR)
 
107
        if [ -f $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE) ]; then install --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE).new; else install --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR); fi
 
108
 
 
109
install-suspend: $(S2DISK) $(S2BOTH) conf/$(CONFIGFILE)
 
110
        if [ ! -c /dev/snapshot ]; then mknod /dev/snapshot c 10 231; fi
 
111
        install --mode=755 $(S2DISK) $(DESTDIR)$(SUSPEND_DIR)
 
112
        install --mode=755 $(S2BOTH) $(DESTDIR)$(SUSPEND_DIR)
 
113
        if [ -f $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE) ]; then install --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE).new; else install --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR); fi
 
114
        install --mode=755 s2ram $(DESTDIR)$(SUSPEND_DIR)
 
115
endif
 
116
 
 
117
install-resume-initrd:  resume conf/$(CONFIGFILE)
 
118
        BOOT_DIR=$(DESTDIR)$(BOOT_DIR) ./scripts/create-resume-initrd.sh $(RESUME_DEVICE)
 
119
 
 
120
install-resume:         resume 
 
121
        ./scripts/install-resume.sh
 
122