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:
Sylvain Munaut 2019-08-05 15:24:16 +02:00
parent fbf196378e
commit ef372d0161
4 changed files with 8 additions and 5 deletions

View File

@ -4,15 +4,18 @@ Q := @
endif
PC_HOSTED =
NO_LIBOPENCM3 =
ifeq ($(PROBE_HOST), libftdi)
PC_HOSTED = true
NO_LIBOPENCM3 = true
endif
ifeq ($(PROBE_HOST), pc-stlinkv2)
PC_HOSTED = true
NO_LIBOPENCM3 = true
endif
all:
ifndef PC_HOSTED
ifndef NO_LIBOPENCM3
$(Q)if [ ! -f libopencm3/Makefile ]; then \
echo "Initialising git submodules..." ;\
git submodule init ;\
@ -23,7 +26,7 @@ endif
$(Q)$(MAKE) $(MFLAGS) -C src
clean:
ifndef PC_HOSTED
ifndef NO_LIBOPENCM3
$(Q)$(MAKE) $(MFLAGS) -C libopencm3 $@
endif
$(Q)$(MAKE) $(MFLAGS) -C src $@

View File

@ -21,7 +21,7 @@
#ifndef __GDB_IF_H
#define __GDB_IF_H
#if !defined(PC_HOSTED)
#if !defined(NO_LIBOPENCM3)
#include <libopencm3/usb/usbd.h>
void gdb_usb_out_cb(usbd_device *dev, uint8_t ep);
#endif

View File

@ -1,5 +1,5 @@
SYS = $(shell $(CC) -dumpmachine)
CFLAGS += -DPC_HOSTED -DENABLE_DEBUG
CFLAGS += -DPC_HOSTED -DNO_LIBOPENCM3 -DENABLE_DEBUG
LDFLAGS += -lftdi1
ifneq (, $(findstring mingw, $(SYS)))
LDFLAGS += -lusb-1.0 -lws2_32

View File

@ -1,6 +1,6 @@
TARGET=blackmagic_stlinkv2
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
LDFLAGS += -lusb-1.0
ifneq (, $(findstring mingw, $(SYS)))