]> git.ozlabs.org Git - petitboot/blobdiff - Makefile
Add 'make dist' target
[petitboot] / Makefile
index 669e56a8210834994394dad86e7a41a0d318c03f..64a8c46e630bc8fbc759a20a3a30dfa2957d4089 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,16 @@
+PREFIX?=/usr
+VERSION=0.0.1
+PACKAGE=petitboot
 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 +24,27 @@ 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))
+
+dist:  $(PACKAGE)-$(VERSION).tar.gz
+
+$(PACKAGE)-$(VERSION).tar.gz: $(PACKAGE)-$(VERSION)
+       tar czvf $@ $^
+
+$(PACKAGE)-$(VERSION): clean
+       mkdir $@ $@/devices
+       cp -a artwork $@
+       cp *.[ch] $@
+       cp -a devices/*.[ch] $@/devices/
+       cp Makefile $@
+
 clean:
        rm -f petitboot
        rm -f udev-helper