Skip to content

Build & Install Guide

Scover edited this page Apr 7, 2025 · 1 revision

Build & Install Guide

So you want to install a three-line C program like it’s the Linux kernel?

Excellent.

This guide walks you through building and installing argc, with and without make, and explains the surrounding ecosystem magic that makes tiny tools like this feel like real software.

Prerequisites

To build and install argc, you’ll need:

  • A C compiler (such as gcc or clang)
  • Basic POSIX command-line tools (make, install, rm)
  • A terminal
  • A sense of humor (optional, but encouraged)

There are no dependencies, no libraries to install, no network calls, no build system sorcery. Just pure, portable C.

Using make (recommended)

If you're on a Unix-like system, this is the easiest and most idiomatic way:

make
sudo make install

This will:

  • Compile the argc program with optimization and warnings enabled
  • Install it to /usr/local/bin/argc
  • Install the manpage to /usr/local/share/man/man1/argc.1

Once installed, you can run:

argc foo bar

And it will print:

3

And you can read the manpage with:

man argc

To remove the installed binary and manpage:

sudo make uninstall

To clean up the compiled binary:

make clean

Without make (manual method)

You can also compile and install everything manually:

cc -O2 -Wall -o argc argc.c
sudo install -Dm755 argc /usr/local/bin/argc
sudo install -Dm644 argc.1 /usr/local/share/man/man1/argc.1

Want to uninstall?

sudo rm /usr/local/bin/argc
sudo rm /usr/local/share/man/man1/argc.1

Portability

  • argc is 100% POSIX-friendly (no platform-specific hacks)
  • It builds with GCC, Clang, and any C compiler that supports C89 or newer
  • It runs on any Unix-like system (Linux, macOS, BSD, even WSL)

If you can compile C, you can compile argc.

Summary

Command What it does
make Compiles the program
make install Installs the binary and manpage
make uninstall Removes the installed files
make clean Deletes the compiled binary
cc -o argc argc.c Manual build without make

Tip

If you're using a nonstandard install prefix (like for packaging), you can run:

make PREFIX=/some/other/path install

If something breaks during install… it's probably not argc.
It’s probably your system. Or your karma.

Either way—happy hacking.

Clone this wiki locally