Skip to content

Commit

Permalink
Makefile: Add support for INSTALL_PREFIX
Browse files Browse the repository at this point in the history
Add basic support for INSTALL_PREFIX

make install INSTALL_PREFIX=/usr/local
make uninstall INSTALL_PREFIX=/usr/local

See: raspberrypi#208
  • Loading branch information
timg236 committed Apr 10, 2024
1 parent 20f22d1 commit 1b494b1
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PKG_VER=$(shell grep rpiboot debian/changelog | head -n1 | sed 's/.*(\(.*\)).*/\1/g')
GIT_VER=$(shell git rev-parse HEAD 2>/dev/null | cut -c1-8 || echo "")
INSTALL_PREFIX?=/usr

rpiboot: main.c bootfiles.c msd/bootcode.h msd/start.h msd/bootcode4.h msd/start4.h
$(CC) -Wall -Wextra -g -o $@ main.c bootfiles.c `pkg-config --cflags --libs libusb-1.0` -DGIT_VER="\"$(GIT_VER)\"" -DPKG_VER="\"$(PKG_VER)\""
Expand All @@ -14,17 +15,17 @@ bin2c: bin2c.c
$(CC) -Wall -Wextra -g -o $@ $<

install: rpiboot
install -m 755 rpiboot /usr/bin/
install -d /usr/share/rpiboot
install -d /usr/share/rpiboot/msd
install -m 644 msd/bootcode.bin /usr/share/rpiboot/msd
install -m 644 msd/bootcode4.bin /usr/share/rpiboot/msd
install -m 644 msd/start.elf /usr/share/rpiboot/msd
install -m 644 msd/start4.elf /usr/share/rpiboot/msd
install -m 755 rpiboot $(INSTALL_PREFIX)/bin/
install -d $(INSTALL_PREFIX)/share/rpiboot
install -d $(INSTALL_PREFIX)/share/rpiboot/msd
install -m 644 msd/bootcode.bin $(INSTALL_PREFIX)/share/rpiboot/msd
install -m 644 msd/bootcode4.bin $(INSTALL_PREFIX)/share/rpiboot/msd
install -m 644 msd/start.elf $(INSTALL_PREFIX)/share/rpiboot/msd
install -m 644 msd/start4.elf $(INSTALL_PREFIX)/share/rpiboot/msd

uninstall:
rm -f /usr/bin/rpiboot
rm -rf /usr/share/rpiboot
rm -f $(INSTALL_PREFIX)/bin/rpiboot
rm -rf $(INSTALL_PREFIX)/share/rpiboot

clean:
rm -f rpiboot msd/*.h bin2c
Expand Down

0 comments on commit 1b494b1

Please sign in to comment.