优化抽象工厂模式示例,添加品牌方法并重构工厂实现,更新构建脚本以支持更清晰的输出

This commit is contained in:
2025-12-09 10:56:44 +08:00
parent c5c0cf76b2
commit 59f61e54fd
5 changed files with 97 additions and 63 deletions
+12 -6
View File
@@ -1,9 +1,16 @@
BUILDDIR := build
DIRS := $(shell ls -d */)
ifndef VERBOSE
.SILENT:
endif
all: build test clean
.PHONY: build
build:
mkdir -p $(BUILDDIR); \
echo "Building Go examples..."
mkdir -p $(BUILDDIR)
for dir in $(DIRS); do \
if [ ! -f "$$dir/main.go" ]; then \
continue; \
@@ -17,12 +24,11 @@ test:
for bin in $(BUILDDIR)/*; do \
echo "\n"; \
$$bin; \
done; \
echo "\nAll Go examples executed.\n"
echo "\n"; \
done
echo "All Go examples executed."
.PHONY: clean
clean:
echo "Cleaning build directory..."
rm -rf $(BUILDDIR)/*
.PHONY: all
all: build test clean