Make petitboot installable
[petitboot] / Makefile
1 PREFIX?=/usr
2 CC=gcc
3 INSTALL=install
4 TWIN_CFLAGS=$(shell pkg-config --cflags libtwin)
5 TWIN_LDFLAGS=$(shell pkg-config --libs libtwin)
6
7 LDFLAGS = 
8 CFLAGS = -O0 -ggdb -Wall '-DPREFIX="$(PREFIX)"'
9
10 PARSERS = native
11 ARTWORK = background.png cdrom.png hdd.png usbpen.png cursor
12
13 all: petitboot udev-helper
14
15 petitboot: petitboot.o devices.o
16         $(CC) $(LDFLAGS) -o $@ $^
17
18 petitboot: LDFLAGS+=$(TWIN_LDFLAGS)
19 petitboot: CFLAGS+=$(TWIN_CFLAGS)
20
21 udev-helper: devices/udev-helper.o devices/params.o \
22                 $(foreach p,$(PARSERS),devices/$(p)-parser.o)
23         $(CC) $(LDFLAGS) -o $@ $^
24
25 devices/%: CFLAGS+=-I.
26
27 install: all
28         $(INSTALL) -D petitboot $(PREFIX)/sbin/petitboot
29         $(INSTALL) -D udev-helper $(PREFIX)/sbin/udev-helper
30         $(INSTALL) -Dd $(PREFIX)/share/petitboot/artwork/
31         $(INSTALL) -t $(PREFIX)/share/petitboot/artwork/ \
32                 $(foreach a,$(ARTWORK),artwork/$(a))
33
34 clean:
35         rm -f petitboot
36         rm -f udev-helper
37         rm -f *.o devices/*.o