@@ -123,3 +123,47 @@ $(BINARY_DIRECTORY)/core.a: $(C_OBJECTS) $(CPP_OBJECTS_CORE)
123
123
124
124
$(OUTPUT_BINARY ) : $(BINARY_DIRECTORY ) $(CPP_OBJECTS_TESTS ) $(BINARY_DIRECTORY ) /core.a
125
125
$(CXX ) $(LDFLAGS ) $(CPP_OBJECTS_TESTS ) $(BINARY_DIRECTORY ) /core.a $(LIBS ) -o $(OUTPUT_BINARY )
126
+
127
+ # ################################################
128
+ # building ino sources
129
+ -include Makefile.inc.ino
130
+
131
+ % .ino-host : % .ino-host.o
132
+
133
+ SDK_PATH := core-mock ../../tools/sdk/include
134
+ CORE_LIB_PATH := ../../libraries/ESP8266WiFi/src
135
+
136
+ INC_CORE_PATHS += $(addprefix -I, \
137
+ $(CORE_LIB_PATH ) \
138
+ $(SDK_PATH ) \
139
+ )
140
+
141
+ % .ino-host.o : % .ino-host.cpp
142
+ $(CXX ) -include core-mock/mock.h $(CXXFLAGS ) $(INC_PATHS ) $(INC_CORE_PATHS ) -c -o $@ $<
143
+
144
+ .PRECIOUS : % -host.cpp
145
+ % .ino-host.cpp : % .ino
146
+ cp $< $@
147
+
148
+ # ################################################
149
+ # Makefile.inc.ino generation
150
+
151
+ # default "examples" rule (overridden in Makefile.inc.ino when built)
152
+ .PHONY : examples
153
+ examples :
154
+ # copy examples locally
155
+ rm -f Makefile.inc.ino
156
+ all=" " ; \
157
+ for dir in ../../libraries/* /examples; do \
158
+ exampledir=$$ {dir%/* }; \
159
+ exampledirname=$$ {exampledir## */}; \
160
+ for subdir in $$ dir/* ; do \
161
+ exname=$$ {subdir## */}; \
162
+ mkdir -p examples/$$ exampledirname/$$ exname; \
163
+ (cd $$ subdir && tar cf - .) | (cd examples/$$ exampledirname/$$ exname; tar xf -); \
164
+ echo examples/$$ exampledirname/$$ exname/$$ exname-host: examples/$$ exampledirname/$$ exname/$$ exname.ino >> Makefile.inc.ino; \
165
+ all=" $$ all examples/$$ exampledirname/$$ exname/$$ exname.ino-host" ; \
166
+ done ; \
167
+ done ; \
168
+ echo " $@ : $$ all" >> Makefile.inc.ino
169
+ $(MAKE ) $@
0 commit comments