diff options
| author | czjstmax <jstmaxlol@disroot.org> | 2025-12-19 23:32:31 +0100 |
|---|---|---|
| committer | czjstmax <jstmaxlol@disroot.org> | 2025-12-19 23:32:31 +0100 |
| commit | 1c11d915a68e60bd191d43e348d56b9eab71b107 (patch) | |
| tree | 0b79d8ce3f47bc7ead2143e6f6e10e3f7df9075e /Makefile | |
| parent | fe0479de0c0305eafb1d3aa1456850af9e3b4fca (diff) | |
Created `src` dir for code, added Makefile
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 58 |
1 files changed, 58 insertions, 0 deletions
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) |