Skip to main content

Checkpoint: Rebuild Engine

Challenge on lesson: Checkpoint: Build Decisions

CHALLENGE
Difficulty: advanced+25 XP

Implement three functions: 1. int rebuild(long long tgt, const long long *deps, size_t n, int phony, int strict) โ€” rebuilds if phony; else if strict, any prerequisite *not older* than the target triggers (>=); else only strictly newer (>). 2. size_t count_rebuilds(long long tgt, const long long *obj_mtimes, size_t n) โ€” how many object files (as targets of their own rules) are older than the changed source at tgt... model: count objects whose mtime < tgt (they will rebuild). 3. const char *strictness_effect(int strict) โ€” return "more rebuilds" for strict=1, "fewer rebuilds" for strict=0.

Back to lesson: Checkpoint: Build Decisions