Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples stuff: fix examples/rules, extend rules and add f7 examples #193

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
18 changes: 17 additions & 1 deletion examples/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,25 @@ else
include $(OPENCM3_DIR)/mk/genlink-rules.mk
endif

# Find libopencm3 library folder
# this tries to match LIBNAME to manufacturer or manufacturer/series folder in lib/
# eg. LIBNAME=lm3s LIBFOLDER=lib/lm3s or LIBNAME=stm32f7 LIBFOLDER=lib/stm32/f7
DIR=$(notdir $(subst /.,,$(wildcard $1/*/.)))
LIBFOLDER=lib/$(strip \
$(foreach M,$(filter-out usb ethernet dispatch,$(call DIR,$(OPENCM3_DIR)/lib)), \
$(if $(subst opencm3_$M,,$(LIBNAME)),\
$(foreach S,$(call DIR,$(OPENCM3_DIR)/lib/$(M)), \
$(if $(subst opencm3_$M$S,,$(LIBNAME)),,$M/$S)), \
$M)))
# exceptions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely not interested in this one. I've had enough rpoblems with people trying to pick and choose things, and reportings bugs when all they really needed to do was just run "make" once in the top and everythign would have been fine. This relies far too much on knowledge of the build system and file structure within the library, which should be treated as a simple .a dependency. It's a submodule for exactly that reason, just build it once, move on.

ifeq ($(LIBFOLDER),lib/lpc43xx)
LIBFOLDER=lib/lpc43xx/m4
endif

# Build libopencm3-lib if it does exists
$(OPENCM3_DIR)/lib/lib$(LIBNAME).a:
$(warning $(LIBNAME).a not found, attempting to rebuild in $(OPENCM3_DIR))
$(MAKE) -C $(OPENCM3_DIR)
$(MAKE) -C $(OPENCM3_DIR) $(LIBFOLDER)
$(OPENCM3_DIR)/include/%.h: $(OPENCM3_DIR)/lib/lib$(LIBNAME).a;

# Define a helper macro for debugging make errors online
Expand Down