lkml.org 
[lkml]   [2017]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] drm: Add O= support
Date
Add an option to put all output files in a given directory, similar to
what kbuild does.

Cc: Carsten Emde <C.Emde@osadl.org>
Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Javi Merino <javi.merino@kernel.org>
---
Documentation/EDID/Makefile | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/Documentation/EDID/Makefile b/Documentation/EDID/Makefile
index 17763ca..76e8ef5 100644
--- a/Documentation/EDID/Makefile
+++ b/Documentation/EDID/Makefile
@@ -1,26 +1,29 @@

+# use "make O=dir" to locate all output files in "dir"
+O ?= .
+
SOURCES := $(wildcard [0-9]*x[0-9]*.S)

-BIN := $(patsubst %.S, %.bin, $(SOURCES))
+BIN := $(patsubst %.S, $(O)/%.bin, $(SOURCES))

-IHEX := $(patsubst %.S, %.bin.ihex, $(SOURCES))
+IHEX := $(patsubst %.S, $(O)/%.bin.ihex, $(SOURCES))

-CODE := $(patsubst %.S, %.c, $(SOURCES))
+CODE := $(patsubst %.S, $(O)/%.c, $(SOURCES))

all: $(BIN) $(IHEX) $(CODE)

clean:
- @rm -f *.o *.bin.ihex *.bin *.c
+ @rm -f $(O)/*.o $(O)/*.bin.ihex $(O)/*.bin $(O)/*.c

-%.o: %.S
- @cc -c $^
+$(O)/%.o: %.S
+ @cc -c $^ -o $@

-%.bin: %.o
+$(O)/%.bin: $(O)/%.o
@objcopy -Obinary $^ $@

-%.bin.ihex: %.o
+$(O)/%.bin.ihex: $(O)/%.o
@objcopy -Oihex $^ $@
@dos2unix $@ 2>/dev/null

-%.c: %.bin
+$(O)/%.c: $(O)/%.bin
@echo "{" >$@; hexdump -f hex $^ >>$@; echo "};" >>$@
--
2.1.4
\
 
 \ /
  Last update: 2017-03-06 15:42    [W:0.049 / U:0.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site