File: Makefile

package info (click to toggle)
hw-detect 1.142
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,664 kB
  • sloc: sh: 1,408; makefile: 103; perl: 102; ansic: 39
file content (119 lines) | stat: -rw-r--r-- 3,760 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

# Take account of old dpkg-architecture output.
ifeq ($(DEB_HOST_ARCH_OS),)
  DEB_HOST_ARCH_OS := $(subst -gnu,,$(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM))
  ifeq ($(DEB_HOST_ARCH_OS),gnu)
    DEB_HOST_ARCH_OS := hurd
  endif
endif

CC = gcc
ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
export CC=$(DEB_HOST_GNU_TYPE)-gcc
endif
CPPFLAGS =
CFLAGS = -W -Wall -Os -g
CFLAGS_ARCH = -DCPU_TEXT='"$(DEB_HOST_ARCH)"'

# Use hardening flags too
CFLAGS += `dpkg-buildflags --get CFLAGS`
CPPFLAGS += `dpkg-buildflags --get CPPFLAGS`

bindir=$(DESTDIR)/bin/
hpdir=$(DESTDIR)/etc/hotplug.d
netdir=$(DESTDIR)/etc/network
udevdir=$(DESTDIR)/etc/udev/rules.d
didir=$(DESTDIR)/lib/debian-installer.d
fidir=$(DESTDIR)/usr/lib/finish-install.d
sharedir=$(DESTDIR)/usr/share/hw-detect/
postbaseinstallerdir=$(DESTDIR)/usr/lib/post-base-installer.d/
prepkgseldir=$(DESTDIR)/usr/lib/pre-pkgsel.d/
man1dir=$(DESTDIR)/usr/share/man/man1

INSTALL=install
INSTALL_DATA = ${INSTALL} -m 644

all: archdetect devnames-static.gz

test:
	set -e; for sh in *.sh; do sh -n $$sh; done

clean:
	rm -f *~
	rm -f *.o
	rm -f archdetect
	rm -f devnames-static.gz

install: install-hw-detect install-ethdetect install-disk-detect install-driver-injection-disk-detect install-archdetect install-archdetect-deb

install-hw-detect: hw-detect.sh
	$(INSTALL) -d $(bindir)
ifeq ($(DEB_HOST_ARCH_OS),linux)
	$(INSTALL) hw-detect.sh $(bindir)/hw-detect
	$(INSTALL) hotplug-pcmcia.sh $(bindir)/hotplug-pcmcia
	$(INSTALL) sysfs-update-devnames.sh $(bindir)/sysfs-update-devnames
	$(INSTALL) -d $(udevdir)
	$(INSTALL_DATA) net-hotplug.rules $(udevdir)/010_net-hotplug.rules
	$(INSTALL) check-missing-firmware.sh $(bindir)/check-missing-firmware
	$(INSTALL) -d $(postbaseinstallerdir)
	$(INSTALL) hw-detect.post-base-installer.d/* $(postbaseinstallerdir)
	$(INSTALL) -d $(prepkgseldir)
	$(INSTALL) hw-detect.pre-pkgsel.d/* $(prepkgseldir)
	$(INSTALL) -d $(hpdir)/net
	$(INSTALL) net-hotplug.sh $(hpdir)/net/hw-detect.hotplug
	$(INSTALL) -d $(fidir)
	$(INSTALL) hw-detect.finish-install.d/* $(fidir)
ifeq ($(DEB_HOST_ARCH),powerpc)
	$(INSTALL) discover-mac-io.sh $(bindir)/discover-mac-io
	$(INSTALL) discover-ibm.sh $(bindir)/discover-ibm
endif
ifeq ($(DEB_HOST_ARCH),sparc)
	$(INSTALL) discover-sbus.sh $(bindir)/discover-sbus
	$(INSTALL) -d $(sharedir)
	$(INSTALL_DATA) sbus.list $(sharedir)/sbus.list
endif
else
	$(INSTALL) detect-stub.sh $(bindir)/hw-detect
endif
	$(INSTALL) -d $(sharedir)
	$(INSTALL_DATA) firmware-map $(sharedir)/firmware-map

install-ethdetect: ethdetect.sh
	$(INSTALL) -d $(bindir) $(netdir)
	$(INSTALL) ethdetect.sh $(bindir)/ethdetect
	$(INSTALL) -m644 devnames-static.gz $(netdir)/

install-disk-detect: disk-detect.sh
	$(INSTALL) -d $(bindir)
	$(INSTALL) disk-detect.sh $(bindir)/disk-detect

install-driver-injection-disk-detect: driver-injection-disk.sh
	$(INSTALL) -d $(bindir)
	$(INSTALL) driver-injection-disk.sh $(bindir)/driver-injection-disk

install-archdetect: archdetect
	$(INSTALL) -d $(bindir)
	$(INSTALL) archdetect $(bindir)

install-archdetect-deb: archdetect
	$(INSTALL) -d $(bindir)
	$(INSTALL) archdetect $(bindir)
	$(INSTALL) -d $(man1dir)
	$(INSTALL) archdetect.1 $(man1dir)

archdetect: archdetect.o 
	${CC} ${LDFLAGS} -o $@ $^ -ldebian-installer

archdetect.o: %.o:%.c
	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_ARCH) -c $<

devnames-static.gz: devnames-static.txt
	grep -v '^#' $< | gzip -9cn > $@

.PHONY: firmware-map
firmware-map:
	./build-firmware-map --verbose > $@