Skip to contentSkip to conversation

wireless-regdb: Add install target to Makefile

PATCH In review Michael Buesch 2 participants 3 messages Dec 26, 2008 – Dec 27, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wireless-regdb: Add install target to Makefile

This adds an "install" target to the Makefile.
We intentionally don't make install depend on "all" or another build target, to avoid an undesired rebuild.

Makefile +7 -1
Index: wireless-regdb/Makefile
===================================================================
@@ -1,4 +1,7 @@
-.PHONY: all clean
+# Install prefix
+PREFIX = /usr
+
+.PHONY: all clean install
 
 all: regulatory.bin key.pub.pem
 
@@ -13,3 +16,6 @@
 
 key.priv.pem:
 	openssl genrsa -out key.priv.pem 2048
+
+install:
+	-install -o 0 -g 0 -m 644 regulatory.bin $(PREFIX)/lib/crda/regulatory.bin
Signature · 1 line
Greetings, Michael.
#1 lore raw

Review

Quoted 2 lines · Michael Buesch
(quoted diff) +2 -0
+install:
+	-install -o 0 -g 0 -m 644 regulatory.bin $(PREFIX)/lib/crda/regulatory.bin

The directory should be created first. Most likely it doesn't exist.

Also, the minus in front of the "install" command is harmful. Errors should not be ignored. If the file is not installed, "make install" should fail.

"install -D" is not widely used in makefiles, so let's do it in two steps. $(PREFIX)/lib/crda/ could be abstracted as another variable.

Here's my take:

wireless-regdb: Add install target to Makefile

Makefile +9 -1
index 1d8ff2a..56881a7 100644
@@ -1,4 +1,8 @@
-.PHONY: all clean
+# Install prefix
+PREFIX = /usr
+CDRA_PATH = $(PREFIX)/lib/crda
+
+.PHONY: all clean install
 
 all: regulatory.bin key.pub.pem
 
@@ -13,3 +17,7 @@ key.pub.pem: key.priv.pem
 
 key.priv.pem:
 	openssl genrsa -out key.priv.pem 2048
+
+install:
+	install -o 0 -g 0 -m 755 -d $(CDRA_PATH)
+	install -o 0 -g 0 -m 644 regulatory.bin $(CDRA_PATH)/regulatory.bin
Signature · 2 lines
Regards,
Pavel Roskin
#2 lore raw
Quoted 6 lines · On Saturday 27 December 2008 07:42:54 Pavel Roskin wrote:

Review

Quoted 2 lines · Michael Buesch
(quoted diff) +2 -0
+install:
+	-install -o 0 -g 0 -m 644 regulatory.bin $(PREFIX)/lib/crda/regulatory.bin

The directory should be created first. Most likely it doesn't exist.

Quoted 8 lines

Also, the minus in front of the "install" command is harmful. Errors should not be ignored. If the file is not installed, "make install" should fail.

"install -D" is not widely used in makefiles, so let's do it in two steps. $(PREFIX)/lib/crda/ could be abstracted as another variable.

Here's my take:

ok thanks

Signature · 1 line
Greetings, Michael.