Makefile: implement GNU Coding Standard for Makefiles

GNU coding standards notably specifies:
* install files with the $(DESTDIR) to the target system image
* install files with the $(prefix), not $(PREFIX)
* the default value of $(prefix) should be /usr/local

as per https://www.gnu.org/prep/standards/html_node/Directory-Variables.html.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
This commit is contained in:
Nicolas Dechesne
2016-06-05 21:40:06 +02:00
parent 62f4c6a799
commit d42cf61564

View File

@@ -2,6 +2,7 @@ OUT := qmic
CFLAGS := -Wall -g -O2
LDFLAGS :=
prefix := /usr/local
SRCS := qmic.c qmi_message.c qmi_struct.c
OBJS := $(SRCS:.c=.o)
@@ -10,7 +11,7 @@ $(OUT): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $^
install: $(OUT)
install -D -m 755 $< $(PREFIX)/bin/$<
install -D -m 755 $< $(DESTDIR)$(prefix)/bin/$<
clean:
rm -f $(OUT) $(OBJS)