Skip to content

Commit af53a11

Browse files
committed
smarter makefile: only re-run chat build if sources haven't changed
1 parent 481447d commit af53a11

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
embed:
1+
CHAT_SOURCES_STAMP = chat/.sources.stamp
2+
CHAT_SOURCES = $(shell find chat \( -path chat/node_modules -o -path chat/out -o -path chat/.next \) -prune -o -not -path chat/.sources.stamp -type f -print)
3+
4+
$(CHAT_SOURCES_STAMP): $(CHAT_SOURCES)
5+
@echo "Chat sources changed. Running build steps..."
26
cd chat && bun run build
37
rm -rf lib/httpapi/chat && mkdir -p lib/httpapi/chat && touch lib/httpapi/chat/marker
48
cp -r chat/out/. lib/httpapi/chat/
9+
touch $@
10+
11+
.PHONY: embed
12+
embed: $(CHAT_SOURCES_STAMP)
13+
@echo "Chat build is up to date."
514

15+
.PHONY: build
616
build: embed
717
go build -o agentapi main.go

chat/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ yarn-error.log*
3939
# typescript
4040
*.tsbuildinfo
4141
next-env.d.ts
42+
.sources.stamp

0 commit comments

Comments
 (0)