~udienz/+junk/debootstrap-blankon

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Andy Apdhani
  • Date: 2007-09-29 13:24:53 UTC
  • Revision ID: imtheface@ubuntu.com-20070929132453-r0ir93lt4fk29u7m
Impor awal

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
CC=gcc
 
2
CFLAGS=-Wall -W -O2
 
3
 
 
4
# avoid dpkg-dev dependency; fish out the version with sed
 
5
VERSION := $(shell sed 's/.*(\(.*\)).*/\1/; q' debian/changelog)
 
6
 
 
7
ARCH := $(shell dpkg --print-architecture)
 
8
setarchdevs = $(if $(findstring $(ARCH),$(1)),$(2))
 
9
 
 
10
DEVS := generic hde hdf hdg hdh sde sdf sdg sdh scd-all initrd input usb md lp rtc video \
 
11
        $(call setarchdevs,i386,isdn-io eda edb sonycd mcd mcdx cdu535 \
 
12
                                optcd sjcd cm206cd gscd lmscd sbpcd \
 
13
                                aztcd bpcd dac960 ida fd0 fd1 ataraid cciss) \
 
14
        $(call setarchdevs,sparc,hdc hdd busmice) \
 
15
        $(call setarchdevs,m68k,fd0 fd1 adc add ade adf hdc hdd) \
 
16
        $(call setarchdevs,powerpc,hdc hdd fd0 fd1 isdn-io m68k-mice) \
 
17
        $(call setarchdevs,ia64,ida fd0 fd1 ataraid cciss)
 
18
 
 
19
MAKEDEV := $(shell if [ -e /dev/MAKEDEV ]; then echo /dev/MAKEDEV; else echo /sbin/MAKEDEV; fi)
 
20
 
 
21
all: pkgdetails devices-std.tar.gz devices.tar.gz debootstrap-arch
 
22
clean:
 
23
        rm -f pkgdetails pkgdetails.o devices-std.tar.gz devices.tar.gz
 
24
        rm -f debootstrap-arch
 
25
        rm -rf dev
 
26
 
 
27
DSDIR=$(DESTDIR)/usr/lib/debootstrap
 
28
install:
 
29
        mkdir -p $(DSDIR)/scripts
 
30
        mkdir -p $(DESTDIR)/usr/sbin
 
31
        mkdir -p $(DESTDIR)/usr/share/man/man8
 
32
        install -o root -g root -m 0644 scripts/debian/* $(DSDIR)/scripts/
 
33
        install -o root -g root -m 0644 scripts/ubuntu/* $(DSDIR)/scripts/
 
34
        install -o root -g root -m 0644 functions $(DSDIR)/
 
35
 
 
36
        # no special script for etch anymore
 
37
        ln -s sid $(DSDIR)/scripts/etch
 
38
        ln -s sid $(DSDIR)/scripts/lenny
 
39
 
 
40
        install -o root -g root -m 0755 debootstrap.8 $(DESTDIR)/usr/share/man/man8/
 
41
        sed 's/@VERSION@/$(VERSION)/g' debootstrap >$(DESTDIR)/usr/sbin/debootstrap
 
42
        chown root:root $(DESTDIR)/usr/sbin/debootstrap
 
43
        chmod 0755 $(DESTDIR)/usr/sbin/debootstrap
 
44
 
 
45
install-allarch: install
 
46
        install -o root -g root -m 0644 devices-std.tar.gz \
 
47
                $(DSDIR)/devices.tar.gz
 
48
 
 
49
install-arch: install
 
50
        install -o root -g root -m 0755 pkgdetails $(DSDIR)/
 
51
        install -o root -g root -m 0644 devices.tar.gz $(DSDIR)/
 
52
        install -o root -g root -m 0644 debootstrap-arch $(DSDIR)/arch
 
53
 
 
54
pkgdetails: pkgdetails.o
 
55
        $(CC) -o $@ $^
 
56
 
 
57
debootstrap-arch:
 
58
        echo $(ARCH) >debootstrap-arch
 
59
 
 
60
devices-std.tar.gz:
 
61
        rm -rf dev
 
62
        mkdir -p dev
 
63
        chown 0:0 dev
 
64
        chmod 755 dev
 
65
        (cd dev && $(MAKEDEV) std ptmx fd)
 
66
        tar cf - dev | gzip -9 >devices-std.tar.gz
 
67
        rm -rf dev
 
68
 
 
69
devices.tar.gz:
 
70
        rm -rf dev
 
71
 
 
72
        mkdir -p dev
 
73
        chown 0:0 dev
 
74
        chmod 755 dev
 
75
 
 
76
        (cd dev && $(MAKEDEV) $(DEVS))
 
77
 
 
78
ifeq ($(ARCH),powerpc)
 
79
#       Maybe remove amiga/atari mice also? What about usbmouse?
 
80
        rm -f dev/adbmouse
 
81
        ln -sf input/mice dev/mouse
 
82
        ln -sf input/js0 dev/js0
 
83
        ln -sf input/js1 dev/js1
 
84
endif
 
85
 
 
86
        @if ! find dev -maxdepth 0 -perm 755 -uid 0 -gid 0 | \
 
87
                grep -q "^dev$$"; \
 
88
        then \
 
89
           echo "======================================================="; \
 
90
           echo "ERROR"; echo; \
 
91
           echo "./dev has bad permissions! should be 755 root.root. Was:"; \
 
92
           ls -ld ./dev; \
 
93
           echo "======================================================="; \
 
94
           false; \
 
95
        fi
 
96
 
 
97
        tar cf - dev | gzip -9 >devices.tar.gz
 
98
        rm -rf dev
 
99