testsAndMisc/linux_configuration/C/atop_agg/Makefile
Krzysztof kuhy Rudnicki da1e0d3588 atop_agg: split atop_agg.c 478 -> 204 + state + emit
Three units along the file's own concerns:

  atop_agg.c (204)        ingest -- tokenising atop output, folding lines, main
  atop_agg_state.c (113)  the per-PID hash tables, slot lookup, epochs, alloc
  atop_agg_emit.c (178)   the ranked, name-aggregated report

Table geometry and the four table functions that now cross a unit boundary go
in a private atop_agg_internal.h. Those four lose `static` -- the one
visibility change here.

The Makefile edit is the load-bearing part: SRC had to grow or the build would
have linked the old single unit and the suite would have passed with the new
files unused. Checked by reading the compile line, not the exit status.

I had written this file off as unverifiable earlier. Wrong: the Makefile has
had test and coverage targets all along. Coverage is 92.9% lines / 100%
functions on the same 211 source lines, before and after -- the best verifier
of anything left over the cap. Production binary builds at -O2 and runs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
2026-08-17 10:49:46 +02:00

34 lines
971 B
Makefile

CC := gcc
CFLAGS := -O2 -std=c11 -D_POSIX_C_SOURCE=200809L -Wall -Wextra -Wno-unused-parameter
COV := -O0 -g --coverage -std=c11 -D_POSIX_C_SOURCE=200809L -Wall -Wextra -Wno-unused-parameter -DATOP_AGG_NO_MAIN
SRC := atop_agg.c atop_agg_state.c atop_agg_emit.c
HDR := atop_agg.h atop_agg_internal.h
BIN := atop_agg
.PHONY: all clean rebuild test coverage
all: $(BIN)
$(BIN): $(SRC) $(HDR)
$(CC) $(CFLAGS) -o $@ $(SRC)
test_atop_agg: test_atop_agg.c $(SRC) $(HDR)
$(CC) $(COV) -o test_atop_agg test_atop_agg.c $(SRC)
test: test_atop_agg
./test_atop_agg
coverage: test_atop_agg
./test_atop_agg
lcov --capture --directory . --output-file coverage.info --no-external
lcov --remove coverage.info '*/test_atop_agg.c' --output-file coverage.info
genhtml coverage.info --output-directory coverage_html
@echo "Coverage report at coverage_html/index.html"
clean:
rm -f $(BIN) test_atop_agg *.o *.gcda *.gcno coverage.info
rm -rf coverage_html
rebuild: clean all