How morilhat-paul/preprocessor works
Main Components
a. Source Modules
• main.c: the entry point, contains your core logic and uses macros.
• main.h: declarations for functions or types used by main.c.
• log.h: header defining logging macros (operators, directives) you’re experimenting with.
b. Build System
• Makefile: orchestrates preprocessing, compilation, and linking.
c. Build Stages (Processes)
• Preprocessor: expands all #includes, macros, conditional directives.
• Compiler (cc/gcc): parses the expanded source into object code.
• Linker: resolves symbols, produces final executable.
d. Artifacts
• .o object files (intermediate).
• final executable (e.g., a.out or named binary).
Relationships & Data Flow
• main.c “includes” main.h and log.h → send these into the preprocessor.
• Preprocessor outputs a single translation unit (fully expanded C code).
• Compiler consumes that translation unit → produces main.o.
• Linker takes main.o → spits out the executable.
• Makefile triggers each stage in sequence (with proper flags).
Architectural/Design Principles
• Modularity via headers: separate declarations (main.h) vs macro definitions (log.h).
• Preprocessor exploration: illustrate how macros in log.h affect the expanded code.
• Single compilation unit: all inclusion happens before compilation, no dynamic linking or plugins.
Relevant Technologies & Tools
• GNU Make (Makefile).
• C Preprocessor (cpp).
• GCC or equivalent C compiler.
• Standard C build pipeline.
Detail Without Overthinking
• Even though it’s small, capture each distinct step.
• How log.h’s macros inject code during preprocessing.