mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-06 15:51:25 +00:00
Revamp rp examples
This commit is contained in:
1 parent
948b56a3ec
commit
83ba170b45
142 files changed
+769
-3721
No files matched your search
@@ -1,11 +1,12 @@
|
||||
TOP ?= ../..
|
||||
# ST_TARGETS = nucleo_h723zg nucleo_f756zg nucleo_h563zi
|
||||
ST_TARGETS = $(basename $(notdir $(wildcard $(TOP)/tutorials/stm32/*/cubemx/*.ioc)))
|
||||
RP_TARGETS = pico-w pico-rndis w5500-evb-pico w55rp20-evb-pico
|
||||
PROJECTS = full
|
||||
TARGETS = desktop pico2_w $(ST_TARGETS)
|
||||
TARGETS = desktop $(RP_TARGETS) $(ST_TARGETS)
|
||||
MX ?= /Applications/STMicroelectronics/STM32CubeMX.app/Contents/MacOs/STM32CubeMX
|
||||
|
||||
DIRS = $(foreach P,$(PROJECTS),$(foreach T,$(TARGETS),$(T)_dashboard_$(P)))
|
||||
DIRS = $(foreach P,$(PROJECTS),$(foreach T,$(TARGETS),$(T)-dashboard-$(P)))
|
||||
ZIPS = $(foreach D,$(DIRS),$(D).zip)
|
||||
|
||||
all:
|
||||
@@ -15,9 +16,9 @@ dirs: $(DIRS)
|
||||
|
||||
zips: $(ZIPS)
|
||||
|
||||
DESKTOP_DIRS = $(foreach P,$(PROJECTS),desktop_dashboard_$(P))
|
||||
DESKTOP_DIRS = $(foreach P,$(PROJECTS),desktop-dashboard-$(P))
|
||||
|
||||
$(DESKTOP_DIRS): desktop_dashboard_%:
|
||||
$(DESKTOP_DIRS): desktop-dashboard-%:
|
||||
mkdir -p $@ $@/resources
|
||||
$(MAKE) -C $(TOP)/tutorials/device-dashboard/$* clean
|
||||
cp $(TOP)/tutorials/device-dashboard/$*/*{c,html,Makefile} $@
|
||||
@@ -26,23 +27,23 @@ $(DESKTOP_DIRS): desktop_dashboard_%:
|
||||
cp $(TOP)/resources/*.js $@/resources
|
||||
sed -i "" "s,../../..,.," $@/Makefile
|
||||
|
||||
.PHONY: pico2_w_dashboard_full
|
||||
|
||||
pico2_w_dashboard_full pico2_w_dashboard_minimal: pico2_w_dashboard_%:
|
||||
mkdir -p $@
|
||||
$(MAKE) -C $(TOP)/tutorials/pico-sdk/pico2_w fullclean
|
||||
cp $(TOP)/tutorials/pico-sdk/pico2_w/* $@/
|
||||
cp $(TOP)/{mongoose.c,mongoose.c,LICENSE} $@/
|
||||
cp $(TOP)/resources/html2c.js $@/
|
||||
cp $(TOP)/tutorials/device-dashboard/$*/{dashboard.c,dashboard.html} $@/
|
||||
sed -i '' -e '/mg_http_listen/d' $@/main.c
|
||||
grep -q 'mg_dash_init' $@/main.c || perl -i -ne 'print; print " mg_dash_init(&mgr);\n" if /mg_mgr_init/' $@/main.c
|
||||
grep -q 'mg_dash_poll' $@/main.c || perl -i -ne 'print; print " mg_dash_poll(&mgr);\n" if /mg_mgr_poll/' $@/main.c
|
||||
grep -q 'dashboard.c' $@/CMakeLists.txt || sed -i -e 's,mongoose.c,mongoose.c dashboard.c file_data.c,' $@/CMakeLists.txt
|
||||
grep -q 'html2c.js' $@/CMakeLists.txt || perl -i -ne 'print "\nadd_custom_command(\n OUTPUT \$${CMAKE_SOURCE_DIR}/file_data.c\n COMMAND node \$${CMAKE_SOURCE_DIR}/html2c.js \$${CMAKE_SOURCE_DIR}/dashboard.html -o \$${CMAKE_SOURCE_DIR}/file_data.c\n DEPENDS \$${CMAKE_SOURCE_DIR}/dashboard.html\n VERBATIM\n)\n\n" if /add_executable/; print;' $@/CMakeLists.txt
|
||||
define RP_DASHBOARD_RULE
|
||||
$(1)-dashboard-$(2):
|
||||
mkdir -p $$@
|
||||
$(MAKE) -C $(TOP)/tutorials/rp/$(1) clean
|
||||
cp -r $(TOP)/tutorials/rp/$(1)/* $$@/
|
||||
cp $(TOP)/{mongoose.c,mongoose.c,LICENSE} $$@/mongoose/
|
||||
cp $(TOP)/resources/html2c.js $$@/mongoose/
|
||||
cp $(TOP)/tutorials/device-dashboard/$(2)/{dashboard.c,dashboard.html} $$@/mongoose/
|
||||
sed -i '' -e '/mg_http_listen/d' $$@/main.c
|
||||
grep -q 'mg_dash_init' $$@/main.c || perl -i -ne 'print; print " mg_dash_init(&mgr);\n" if /mg_mgr_init/' $$@/main.c
|
||||
grep -q 'mg_dash_poll' $$@/main.c || perl -i -ne 'print; print " mg_dash_poll(&mgr);\n" if /mg_mgr_poll/' $$@/main.c
|
||||
grep -q 'dashboard.c' $$@/CMakeLists.txt || sed -i -e 's,mongoose.c,mongoose.c mongoose/dashboard.c mongoose/file_data.c,' $$@/CMakeLists.txt
|
||||
grep -q 'html2c.js' $$@/CMakeLists.txt || perl -i -ne 'print "add_custom_command(\n OUTPUT \$$$${CMAKE_SOURCE_DIR}/mongoose/file_data.c\n COMMAND node \$$$${CMAKE_SOURCE_DIR}/mongoose/html2c.js \$$$${CMAKE_SOURCE_DIR}/mongoose/dashboard.html -o \$$$${CMAKE_SOURCE_DIR}/mongoose/file_data.c\n DEPENDS \$$$${CMAKE_SOURCE_DIR}/mongoose/dashboard.html\n VERBATIM\n)\n\n" if /add_executable/; print;' $$@/CMakeLists.txt
|
||||
endef
|
||||
|
||||
define ST_DASHBOARD_RULE
|
||||
$(1)_dashboard_$(2): $(TOP)/tutorials/stm32/$(1)/cubemx/$(1).ioc
|
||||
$(1)-dashboard-$(2): $(TOP)/tutorials/stm32/$(1)/cubemx/$(1).ioc
|
||||
mkdir -p $$@
|
||||
cp $(TOP)/tutorials/stm32/$(1)/cubemx/* $$@ 2>/dev/null || true
|
||||
echo config load `realpath $$@/$(1).ioc` > gen.mx
|
||||
@@ -53,6 +54,7 @@ $(1)_dashboard_$(2): $(TOP)/tutorials/stm32/$(1)/cubemx/$(1).ioc
|
||||
endef
|
||||
|
||||
$(foreach T,$(ST_TARGETS), $(foreach P,$(PROJECTS), $(eval $(call ST_DASHBOARD_RULE,$(T),$(P)))))
|
||||
$(foreach T,$(RP_TARGETS), $(foreach P,$(PROJECTS), $(eval $(call RP_DASHBOARD_RULE,$(T),$(P)))))
|
||||
|
||||
%.zip: %
|
||||
zip -qr $@ $<
|
||||
@@ -62,5 +64,3 @@ upload: $(ZIPS)
|
||||
|
||||
clean:
|
||||
rm -rf $(DIRS) *.zip
|
||||
|
||||
# rm -rf $(DIRS) $(ZIPS) #$(foreach T,$(ST_TARGETS),$(T)_mongoose)
|
||||
Reference in new issue
Block a user