Alex Hixon avatar Alex Hixon committed c5fbc79

Path fixes within Makefile.

Thanks to Willem van Engen for picking this up. Basically, we now make
sure that we don't override DESTDIR, and make sure that we read out both
it and PREFIX when generating an installation path.

This should also fix building with dpkg.

It's now also possible to easily override the installation name of the
loader executable (currently r5u87x-loader) and the location of the
installed firmware.

Comments (0)

Files changed (1)

-# For build target
+# For build target ---------------------------------------------|
 LIBS=`pkg-config --libs glib-2.0 libusb`
 INCS=`pkg-config --cflags glib-2.0 libusb`
 
-# For install target
+# For install target -------------------------------------------|
+# App to run to install files, usually in path; set otherwise
+INSTALL=install
+
+# FW data
 FIRMWARE="r5u87x-05ca-1803.fw" "r5u87x-05ca-1810.fw" "r5u87x-05ca-1812.fw" "r5u87x-05ca-1830.fw" "r5u87x-05ca-1832.fw" "r5u87x-05ca-1833.fw" "r5u87x-05ca-1834.fw" "r5u87x-05ca-1835.fw" "r5u87x-05ca-1836.fw" "r5u87x-05ca-1837.fw" "r5u87x-05ca-1839.fw" "r5u87x-05ca-183a.fw" "r5u87x-05ca-183b.fw" "r5u87x-05ca-183e.fw" "r5u87x-05ca-1841.fw" "r5u87x-05ca-1870_1.fw" "r5u87x-05ca-1870.fw"
-INSTALL=install
-DESTDIR=/usr
+
+# Modification to filenames
+LOADER_INSTALL=r5u87x-loader
+
+# Directories
+PREFIX=/usr
+INSTALL_PATH=$(DESTDIR)/$(PREFIX)
 bindir=/bin
 libdir=/lib
+FIRMWARE_DIR=$(INSTALL_PATH)$(libdir)/r5u87x/ucode/
 
 .c.o:
 	$(CC) -g -Wall -DHAVE_CONFIG_H $(CFLAGS) $(INCS) -c $*.c $*.h
 	#rm *~
 
 install:	all
-	./mkinstalldirs $(DESTDIR)$(bindir)
-	$(INSTALL) -m 0755 loader $(DESTDIR)$(bindir)/r5u87x-loader
-	./mkinstalldirs $(DESTDIR)$(libdir)/r5u87x/ucode
+	./mkinstalldirs $(INSTALL_PATH)$(bindir)
+	$(INSTALL) -m 0755 loader $(INSTALL_PATH)$(bindir)/$(LOADER_INSTALL)
+	./mkinstalldirs $(FIRMWARE_DIR)
 	@for fw in $(FIRMWARE); do \
-	    echo "$(INSTALL) -m 0644 ucode/$$fw $(DESTDIR)$(libdir)/r5u87x/ucode/$$fw" ; \
-	    $(INSTALL) -m 0666 ucode/$$fw $(DESTDIR)$(libdir)/r5u87x/ucode/$$fw || exit 1 ; \
+	    echo "$(INSTALL) -m 0666 ucode/$$fw $(FIRMWARE_DIR)$$fw" ; \
+	    $(INSTALL) -m 0666 ucode/$$fw $(FIRMWARE_DIR)$$fw || exit 1 ; \
     done
 
 uninstall:
-	rm -fv $(DESTDIR)$(bindir)/r5u87x-loader
-	rm -rfv $(DESTDIR)$(libdir)/r5u87x
+	rm -fv $(INSTALL_PATH)$(bindir)/$(LOADER_INSTALL)
+	rm -rfv $(INSTALL_PATH)$(libdir)/r5u87x
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.