]> git.ozlabs.org Git - petitboot/blobdiff - Makefile
Make petitboot installable
[petitboot] / Makefile
index 669e56a8210834994394dad86e7a41a0d318c03f..a9ae25c09fb65f187fdc6e5adeb5d1736ad41a3b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,14 @@
+PREFIX?=/usr
 CC=gcc
+INSTALL=install
 TWIN_CFLAGS=$(shell pkg-config --cflags libtwin)
 TWIN_LDFLAGS=$(shell pkg-config --libs libtwin)
 
 LDFLAGS = 
-CFLAGS = -O0 -ggdb -Wall
+CFLAGS = -O0 -ggdb -Wall '-DPREFIX="$(PREFIX)"'
 
 PARSERS = native
+ARTWORK = background.png cdrom.png hdd.png usbpen.png cursor
 
 all: petitboot udev-helper
 
@@ -19,6 +22,15 @@ udev-helper: devices/udev-helper.o devices/params.o \
                $(foreach p,$(PARSERS),devices/$(p)-parser.o)
        $(CC) $(LDFLAGS) -o $@ $^
 
+devices/%: CFLAGS+=-I.
+
+install: all
+       $(INSTALL) -D petitboot $(PREFIX)/sbin/petitboot
+       $(INSTALL) -D udev-helper $(PREFIX)/sbin/udev-helper
+       $(INSTALL) -Dd $(PREFIX)/share/petitboot/artwork/
+       $(INSTALL) -t $(PREFIX)/share/petitboot/artwork/ \
+               $(foreach a,$(ARTWORK),artwork/$(a))
+
 clean:
        rm -f petitboot
        rm -f udev-helper