mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Marco Felsch <m.felsch@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] scripts: imx: add Makefile.mingw64
Date: Wed, 1 Nov 2023 09:52:46 +0100	[thread overview]
Message-ID: <20231101085246.GF3359458@pengutronix.de> (raw)
In-Reply-To: <20231018144038.504641-1-m.felsch@pengutronix.de>

On Wed, Oct 18, 2023 at 04:40:38PM +0200, Marco Felsch wrote:
> Add a small Makfile for building the imx-usb-loader.exe outside the
> Kbuild system. The user can compile the tool for windows by:
> 
>   make -f scripts/imx/Makfile.mingw64 LIBUSB_DIR=~/libusb-1.0.26
> 
> or by
> 
>   make -f scripts/imx/Makfile.mingw64 LIBUSB_DIR=~/libusb-1.0.26 O=win
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  scripts/imx/Makefile.mingw64 | 48 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>  create mode 100644 scripts/imx/Makefile.mingw64

Applied, thanks

Sascha

> 
> diff --git a/scripts/imx/Makefile.mingw64 b/scripts/imx/Makefile.mingw64
> new file mode 100644
> index 000000000000..e012d833f1b4
> --- /dev/null
> +++ b/scripts/imx/Makefile.mingw64
> @@ -0,0 +1,48 @@
> +ifeq ($(strip $(LIBUSB_DIR)),)
> +$(error Please specify LIBUSB_DIR e.g. LIBUSB_DIR=~/libusb-1.0.26-binaries)
> +endif
> +
> +CC := x86_64-w64-mingw32-gcc
> +ifeq ($(shell which $(CC)),)
> +$(error "No $(CC) in $(PATH) found")
> +endif
> +
> +LIBUSB_MINGW := $(LIBUSB_DIR)/libusb-MinGW-x64
> +ifeq ($(wildcard $(strip $(LIBUSB_MINGW))),)
> +$(error "$(LIBUSB_MINGW) not found")
> +endif
> +
> +src := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
> +
> +# Do we want to change the working directory?
> +ifeq ("$(origin O)", "command line")
> +  OUTPUT := $(O)
> +else
> +  OUTPUT := $(src)/imx-usb-loader-windows
> +endif # ifneq ($(OUTPUT),)
> +
> +# Make's built-in functions such as $(abspath ...), $(realpath ...) cannot
> +# expand a shell special character '~'. We use a somewhat tedious way here.
> +obj := $(shell mkdir -p $(OUTPUT) && cd $(OUTPUT) && pwd)
> +$(if $(obj),, \
> +     $(error failed to create output directory "$(OUTPUT)"))
> +
> +# $(realpath ...) resolves symlinks
> +obj := $(realpath $(obj))
> +
> +CPPFLAGS := -I $(LIBUSB_MINGW)/include/libusb-1.0 -I $(src)/../include/ -I $(src)/../../include/mach/
> +LDFLAGS := -L $(LIBUSB_MINGW)/lib -lusb-1.0 -static
> +
> +OBJECTS := $(addprefix $(obj)/, imx.o imx-usb-loader.o)
> +
> +$(obj)/%.o: $(src)/%.c
> +	@$(CC) -c -o $@ $< $(CPPFLAGS)
> +
> +$(obj)/imx-usb-loader.exe: $(OBJECTS)
> +	@$(CC) -o $@ $(OBJECTS) $(LDFLAGS)
> +
> +all: $(obj)/imx-usb-loader.exe
> +
> +.PHONY: clean
> +clean:
> +	@rm -rf $(obj)
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      reply	other threads:[~2023-11-01  8:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-18 14:40 Marco Felsch
2023-11-01  8:52 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231101085246.GF3359458@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.felsch@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox