max32630-fthr: create makefile to build / clean all examples

This commit is contained in:
Matthias Ringwald 2017-07-19 13:56:13 +02:00
parent 91401e3752
commit 8f3b3e6c8c
2 changed files with 25 additions and 0 deletions

View File

@ -6,5 +6,6 @@ examples:
clean:
scripts/delete_examples.py
@rm -rf example/Makefile
@echo "Deleting CC2564B Init Script in src folder"
@rm -rf src/cc256x* bluetooth_init*

View File

@ -8,6 +8,24 @@ import shutil
import subprocess
import sys
# build all template
build_all = '''
SUBDIRS = \\
%s
all:
\techo Building all examples
\tfor dir in $(SUBDIRS); do \\
\t$(MAKE) -C $$dir || exit 1; \\
\tdone
clean:
\techo Cleaning all ports
\tfor dir in $(SUBDIRS); do \\
\t$(MAKE) -C $$dir clean; \\
\tdone
'''
# get script path
script_path = os.path.abspath(os.path.dirname(sys.argv[0])) + '/../'
@ -41,10 +59,13 @@ print("Creating example projects:")
# iterate over btstack examples
example_files = os.listdir(examples_embedded)
examples = []
for file in example_files:
if not file.endswith(".c"):
continue
example = file[:-2]
examples.append(example)
# create folder
project_folder = projects_path + example + "/"
@ -72,4 +93,7 @@ for file in example_files:
print("- %s" % example)
with open(projects_path+'Makefile', 'wt') as fout:
fout.write(build_all % ' \\\n'.join(examples))
print("Projects are ready for compile in example folder. See README for details.")