build: Use a separate NO_LIBOPENCM3 flag to disable libopencm3
This prepares to allow other architectures than pc that don't use libopencm3. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
parent
fbf196378e
commit
ef372d0161
7
Makefile
7
Makefile
|
@ -4,15 +4,18 @@ Q := @
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PC_HOSTED =
|
PC_HOSTED =
|
||||||
|
NO_LIBOPENCM3 =
|
||||||
ifeq ($(PROBE_HOST), libftdi)
|
ifeq ($(PROBE_HOST), libftdi)
|
||||||
PC_HOSTED = true
|
PC_HOSTED = true
|
||||||
|
NO_LIBOPENCM3 = true
|
||||||
endif
|
endif
|
||||||
ifeq ($(PROBE_HOST), pc-stlinkv2)
|
ifeq ($(PROBE_HOST), pc-stlinkv2)
|
||||||
PC_HOSTED = true
|
PC_HOSTED = true
|
||||||
|
NO_LIBOPENCM3 = true
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all:
|
all:
|
||||||
ifndef PC_HOSTED
|
ifndef NO_LIBOPENCM3
|
||||||
$(Q)if [ ! -f libopencm3/Makefile ]; then \
|
$(Q)if [ ! -f libopencm3/Makefile ]; then \
|
||||||
echo "Initialising git submodules..." ;\
|
echo "Initialising git submodules..." ;\
|
||||||
git submodule init ;\
|
git submodule init ;\
|
||||||
|
@ -23,7 +26,7 @@ endif
|
||||||
$(Q)$(MAKE) $(MFLAGS) -C src
|
$(Q)$(MAKE) $(MFLAGS) -C src
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
ifndef PC_HOSTED
|
ifndef NO_LIBOPENCM3
|
||||||
$(Q)$(MAKE) $(MFLAGS) -C libopencm3 $@
|
$(Q)$(MAKE) $(MFLAGS) -C libopencm3 $@
|
||||||
endif
|
endif
|
||||||
$(Q)$(MAKE) $(MFLAGS) -C src $@
|
$(Q)$(MAKE) $(MFLAGS) -C src $@
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#ifndef __GDB_IF_H
|
#ifndef __GDB_IF_H
|
||||||
#define __GDB_IF_H
|
#define __GDB_IF_H
|
||||||
|
|
||||||
#if !defined(PC_HOSTED)
|
#if !defined(NO_LIBOPENCM3)
|
||||||
#include <libopencm3/usb/usbd.h>
|
#include <libopencm3/usb/usbd.h>
|
||||||
void gdb_usb_out_cb(usbd_device *dev, uint8_t ep);
|
void gdb_usb_out_cb(usbd_device *dev, uint8_t ep);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SYS = $(shell $(CC) -dumpmachine)
|
SYS = $(shell $(CC) -dumpmachine)
|
||||||
CFLAGS += -DPC_HOSTED -DENABLE_DEBUG
|
CFLAGS += -DPC_HOSTED -DNO_LIBOPENCM3 -DENABLE_DEBUG
|
||||||
LDFLAGS += -lftdi1
|
LDFLAGS += -lftdi1
|
||||||
ifneq (, $(findstring mingw, $(SYS)))
|
ifneq (, $(findstring mingw, $(SYS)))
|
||||||
LDFLAGS += -lusb-1.0 -lws2_32
|
LDFLAGS += -lusb-1.0 -lws2_32
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
TARGET=blackmagic_stlinkv2
|
TARGET=blackmagic_stlinkv2
|
||||||
SYS = $(shell $(CC) -dumpmachine)
|
SYS = $(shell $(CC) -dumpmachine)
|
||||||
CFLAGS += -DPC_HOSTED -DSTLINKV2 -DJTAG_HL -DENABLE_DEBUG
|
CFLAGS += -DPC_HOSTED -DNO_LIBOPENCM3 -DSTLINKV2 -DJTAG_HL -DENABLE_DEBUG
|
||||||
CFLAGS +=-I ./target
|
CFLAGS +=-I ./target
|
||||||
LDFLAGS += -lusb-1.0
|
LDFLAGS += -lusb-1.0
|
||||||
ifneq (, $(findstring mingw, $(SYS)))
|
ifneq (, $(findstring mingw, $(SYS)))
|
||||||
|
|
Loading…
Reference in New Issue