Skip to content

Commit

Permalink
make: print error if make was executed in the root
Browse files Browse the repository at this point in the history
Fixes #1104, alternative to #1178.
  • Loading branch information
Kijewski committed May 15, 2014
1 parent 7acc650 commit e189064
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
28 changes: 22 additions & 6 deletions Makefile
@@ -1,3 +1,13 @@
ifeq (, $(__RIOTBUILD_FLAG))
all: welcome
@echo ""
@exit 1
else
all:
mkdir -p $(BINDIR)
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
endif

DIRS = $(RIOTCPU)/$(CPU) core drivers sys

ifneq (,$(filter embunit,$(USEMODULE)))
Expand All @@ -8,12 +18,7 @@ ifneq (,$(filter embunit_textui,$(USEMODULE)))
DIRS += tests/unittests/embunit/textui
endif


.PHONY: all clean doc

all:
mkdir -p $(BINDIR)
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
.PHONY: all clean doc docclean welcome

clean:
@for i in $(DIRS) ; do "$(MAKE)" -C $$i clean || exit 1; done ;
Expand All @@ -26,3 +31,14 @@ doc:

docclean:
"$(MAKE)" -BC doc/doxygen clean

welcome:
@echo "Welcome to RIOT - The friendly OS for IoT!"
@echo ""
@echo "You executed 'make' from the base directory."
@echo "You should run 'make' in your application's directory instead."
@echo ""
@echo "Please see our Quick Start Guide at:"
@echo " https://github.com/RIOT-OS/RIOT/wiki/Quick-Start-Guide"
@echo "Or ask questions on our mailing list:"
@echo " users@riot-os.org (http://lists.riot-os.org/mailman/listinfo/users)"
4 changes: 4 additions & 0 deletions Makefile.base
@@ -1,3 +1,7 @@
ifeq (, $(__RIOTBUILD_FLAG))
$(error You cannot build a module on its own. Use "make" in your application's directory instead.)
endif

ASMSRC = $(wildcard *.s)
ASSMSRC = $(wildcard *.S)
ASMOBJ = $(ASMSRC:%.s=$(BINDIR)$(MODULE)/%.o)
Expand Down
3 changes: 3 additions & 0 deletions Makefile.include
@@ -1,3 +1,6 @@
# Provide a shallow sanity check. You cannot call `make` in the root directory.
export __RIOTBUILD_FLAG := RIOT

# set undefined variables
RIOTBASE ?= $(shell dirname "$(lastword $(MAKEFILE_LIST))")
export RIOTBASE := $(abspath $(RIOTBASE))
Expand Down

0 comments on commit e189064

Please sign in to comment.