From 1c11d915a68e60bd191d43e348d56b9eab71b107 Mon Sep 17 00:00:00 2001 From: czjstmax Date: Fri, 19 Dec 2025 23:32:31 +0100 Subject: Created `src` dir for code, added Makefile --- Makefile | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6243fb3 --- /dev/null +++ b/Makefile @@ -0,0 +1,58 @@ +CC = cc +# Release options +CFLAGS = -Wall -Wextra -pedantic -O2 +TARGET = build/crbc +# Debug options +DEBUG_CFLAGS = -Wall -Wextra -pedantic -O0 -fsanitize=address,undefined -g +DEBUG_TARGET = debug/crbc +# Source +SRC = src/rbc.c +# Install targets +PREFIX ?= /usr/local +BINDIR = $(PREFIX)/bin +INSTALL_TARGET = crbc +INSTALL_DEBUG_TARGET = $(INSTALL_TARGET)_debug + +# Compile all +All: + $(CC) $(CFLAGS) $(SRC) -o $(TARGET) + $(CC) $(DEBUG_CFLAGS) $(SRC) -o $(DEBUG_TARGET) + +# Compile release (same as 'make') +Release: + $(CC) $(CFLAGS) $(SRC) -o $(TARGET) + +# Compile debug +Debug: + $(CC) $(DEBUG_CFLAGS) $(SRC) -o $(DEBUG_TARGET) + +# Clean all (release + debug) +cleanall: + rm -f $(TARGET) + rm -f $(DEBUG_TARGET) + +# Clean release +CleanRelease: + rm -f $(TARGET) + +# Clean debug +CleanDebug: + rm -f $(DEBUG_TARGET) + +# Install all (release + debug) +Install: + install -Dm755 $(INSTALL_TARGET) $(BINDIR)/crbc + install -Dm755 $(INSTALL_DEBUG_TARGET) $(BINDIR)/crbc + +# Install release +InstallRelease: + install -Dm755 $(INSTALL_TARGET) $(BINDIR)/crbc + +# Install debug +InstallDebug: + install -Dm755 $(INSTALL_DEBUG_TARGET) $(BINDIR)/crbc + +# Uninstall all +Uninstall: + rm -f $(BINDIR)/$(INSTALL_TARGET) + rm -f $(BINDIR)/$(INSTALL_DEBUG_TARGET) -- cgit v1.3.1