-CPPFLAGS:=-g -Wall -Wextra -Werror -DDEBUG
-PROG:=main
-OBJS:=interpret.o sds.o task.o main.o
-
-all: mTaskSymbols.h $(PROG)
-
-%.o: %.cpp
- g++ $(CPPFLAGS) -c $< -o $@
-
-$(PROG): $(OBJS) misc.h
- g++ $(LDFLAGS) -o $@ $(OBJS)
-
-mTaskSymbols.h:
- CLMFLAGS=-nr make -BC .. mTaskInterpret
- ../mTaskInterpret > $@
-
-clean:
- $(RM) $(OBJS) $(PROG)
+export\r
+SHOWPJ = 1\r
+AUTOJ = 1\r
+MAKES = $(wildcard */Makefile)\r
+DIRS = $(patsubst %/Makefile,%,$(MAKES))\r
+CLNS = $(patsubst %,%/cln,$(DIRS))\r
+BINS = $(foreach a,$(DIRS),$(a)/$(a).bin)\r
+\r
+all: $(BINS)\r
+# -test -d com/tools && make -C com/tools all\r
+# @echo made $(BINS)\r
+\r
+hb: $(filter homebus-%,$(BINS))\r
+\r
+tools: \r
+ -test -d com/tools && make -C com/tools all\r
+\r
+info:\r
+ $(info $(BINS))\r
+ $(info $(CLNS))\r
+ $(info $(dir $(BINS)))\r
+ \r
+$(BINS):\r
+ @${MAKE} -C $(dir $@)\r
+\r
+clean: $(CLNS)\r
+ -test -d com/tools && make -C com/tools clean\r
+# -test -d com/homebus-bpi && make -C homebus-bpi clean\r
+ find . -name *.d -o -name *.o -o -name *.a -o -name *.bin -o -name *.out -o -name *.list -o -name *.map -o -name *.hex -o -name *.s19 -o -name *.sl |xargs rm -fv\r
+ -rm -rfv */o/* */filelist\r
+\r
+$(CLNS):\r
+ @${MAKE} -C $(dir $@) clean\r
+ @touch $@\r