]> git.ozlabs.org Git - petitboot/blob - Makefile
Log udev-helper output to /var/log/, not /var/tmp/
[petitboot] / Makefile
1 PREFIX?=/usr
2 VERSION=0.0.1
3 PACKAGE=petitboot
4 CC=gcc
5 INSTALL=install
6 TWIN_CFLAGS?=$(shell pkg-config --cflags libtwin)
7 TWIN_LDFLAGS?=$(shell pkg-config --libs libtwin)
8
9 LDFLAGS = 
10 CFLAGS = --std=gnu99 -O0 -ggdb -Wall '-DPREFIX="$(PREFIX)"'
11
12 PARSERS = native yaboot kboot
13 ARTWORK = background.jpg cdrom.png hdd.png usbpen.png tux.png cursor.gz
14
15 all: petitboot udev-helper
16
17 petitboot: petitboot.o devices.o
18         $(CC) $(LDFLAGS) -o $@ $^
19
20 petitboot: LDFLAGS+=$(TWIN_LDFLAGS)
21 petitboot: CFLAGS+=$(TWIN_CFLAGS)
22
23 udev-helper: devices/udev-helper.o devices/params.o devices/parser.o \
24                 devices/yaboot-cfg.o \
25                 $(foreach p,$(PARSERS),devices/$(p)-parser.o)
26         $(CC) $(LDFLAGS) -o $@ $^
27
28 parser-test: devices/parser-test.o devices/params.o devices/parser.o \
29                 devices/yaboot-cfg.o \
30                 $(foreach p,$(PARSERS),devices/$(p)-parser.o)
31         $(CC) $(LDFLAGS) -o $@ $^
32
33 devices/%: CFLAGS+=-I.
34
35 install: all
36         $(INSTALL) -D petitboot $(DESTDIR)$(PREFIX)/sbin/petitboot
37         $(INSTALL) -D udev-helper $(DESTDIR)$(PREFIX)/sbin/udev-helper
38         $(INSTALL) -Dd $(DESTDIR)$(PREFIX)/share/petitboot/artwork/
39         $(INSTALL) -t $(DESTDIR)$(PREFIX)/share/petitboot/artwork/ \
40                 $(foreach a,$(ARTWORK),artwork/$(a))
41
42 dist:   $(PACKAGE)-$(VERSION).tar.gz
43
44 check:  parser-test
45         devices/parser-test.sh
46
47 distcheck: dist
48         tar -xvf $(PACKAGE)-$(VERSION).tar.gz
49         cd $(PACKAGE)-$(VERSION) && make check
50
51 $(PACKAGE)-$(VERSION).tar.gz: $(PACKAGE)-$(VERSION)
52         tar czvf $@ $^
53
54 $(PACKAGE)-$(VERSION): clean
55         mkdir $@ $@/devices
56         cp -a artwork $@
57         cp -a utils $@
58         cp *.[ch] $@
59         cp -a devices/*.{c,h,sh} $@/devices/
60         cp -a devices/parser-tests $@/devices/
61         cp Makefile $@
62         cp TODO COPYING $@
63
64 clean:
65         rm -rf $(PACKAGE)-$(VERSION)
66         rm -f petitboot
67         rm -f udev-helper
68         rm -f *.o devices/*.o