Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Project516/c-calc/llms.txt

Use this file to discover all available pages before exploring further.

c-calc uses GNU Make and GCC to compile its C source files into a single executable binary named c-calc. The Makefile defines three targets for different use cases: a standard debug build, an optimized release build, and a clean target that removes the binary. A run.sh script is also available to compile and immediately run the program in one step.

Make targets

make / make all

Compiles all source files with warnings enabled and the include/ directory on the header search path. This is the standard development build.
make
# or
make all
Output binary: ./c-calcCompiler flags used:
FlagEffect
-WallEnable all compiler warnings
-IincludeAdd include/ to the header search path
Compiles with maximum optimization and strips debug symbols from the output binary. Use this target when distributing or deploying the program.
make release
Output binary: ./c-calcCompiler flags used (in addition to -Wall -Iinclude):
FlagEffect
-O3Maximum optimization level
-sStrip debug symbols from the binary
Removes the compiled c-calc binary from the working directory. Does not remove object files (none are produced by this build system).
make clean
This permanently deletes the c-calc binary. Run make again to rebuild.

Compiler flags reference

The following table lists every compiler flag used across all Makefile targets.
FlagTargetDescription
-Wallall, releaseEnables all GCC warnings to catch potential bugs at compile time
-Iincludeall, releaseAdds the include/ directory so #include "calc.h" and similar directives resolve correctly
-O3release onlyInstructs GCC to apply the highest level of optimization, improving runtime performance
-srelease onlyStrips the symbol table and debug information from the binary, reducing file size

Source files

The Makefile compiles the following source files in every build:
src/main.c
src/calc.c
src/input.c
src/logic.c
All header files live in include/ and are automatically found because of the -Iinclude flag.

run.sh

If you want to build and immediately start the interactive calculator, use ./run.sh instead of running make and ./c-calc separately. It compiles the project with make and then executes ./c-calc in one step.
./run.sh
Make sure the script is executable before running it:
chmod +x run.sh
./run.sh

Build docs developers (and LLMs) love