sublime-cpp/Makefile
PeterChrz 40c23f9c6b
Sublime Text + clang C++ setup with portable installer
Build systems, Makefile, and a setup script that reproduces this
environment on another machine.

- CP.sublime-build: incremental make-based build, clang++, flags shared
  with clangd via compile_flags.txt
- compete_CPP.sublime-build: competitive-programming workflow, runs
  against inputf.in and diffs the result against expectedf.out
- Makefile: builds every .cpp in the tree into a binary beside its source
- setup.sh: export/install/check, path-neutral payload, idempotent
- README: setup notes, the Sublime $-expansion trap, and the -MMD -MP
  header-dependency limitation to fix later

The .sublime-workspace is deliberately excluded: it holds Sublime's
global recent-file history and absolute paths. Only the pane layout is
portable, extracted to sublime/layout.json.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KCtkkFDkSGi868JWuinwcF
2026-09-07 10:46:56 -04:00

24 lines
813 B
Makefile

# Builds every .cpp in this tree into a binary next to its source.
# Incremental: a file is recompiled only when its .cpp is newer than its binary.
# Flags come from the compile_flags.txt nearest the source (the file clangd
# reads), falling back to the one at the repo root.
CXX := clang++
ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
SRCS := $(shell find $(ROOT) -name '*.cpp')
BINS := $(basename $(SRCS))
# The `@:` recipe is a deliberate no-op. Without it, make prints
# "Nothing to be done for 'all'" whenever everything is already up to date.
all: $(BINS)
@:
%: %.cpp
@flags=$$(cat $(dir $<)compile_flags.txt 2>/dev/null || cat $(ROOT)compile_flags.txt 2>/dev/null); \
echo "compiling $(notdir $<)"; \
$(CXX) $$flags $< -o $@
clean:
@rm -f $(BINS)
@echo "cleaned"
.PHONY: all clean