# Math Utils Makefile # Variables CC = clang CFLAGS = -std=c2x -Iinclude -Wall -Wextra PREFIX = /usr/local BINDIR = $(PREFIX)/bin MANDIR = $(PREFIX)/share/man/man1 # Default target .PHONY: all all: build bin/cdf bin/cumsum # Directory creation targets bin: @mkdir -p bin build: @mkdir -p build # Build targets bin/cdf: bin src/cdf.c include/cdf.h $(CC) $(CFLAGS) src/cdf.c -o bin/cdf bin/cumsum: bin src/cumsum.c include/cumsum.h $(CC) $(CFLAGS) src/cumsum.c -o bin/cumsum # Clean target .PHONY: clean clean: @rm -rf bin build # Install target .PHONY: install install: all @echo "Installing binaries to $(BINDIR)..." @mkdir -p $(BINDIR) @cp bin/cdf $(BINDIR)/ @cp bin/cumsum $(BINDIR)/ @echo "Installing man pages to $(MANDIR)..." @mkdir -p $(MANDIR) @cp doc/cdf.1 $(MANDIR)/ @cp doc/cumsum.1 $(MANDIR)/ @echo "Installation complete." # Uninstall target .PHONY: uninstall uninstall: @echo "Removing binaries from $(BINDIR)..." @rm -f $(BINDIR)/cdf @rm -f $(BINDIR)/cumsum @echo "Removing man pages from $(MANDIR)..." @rm -f $(MANDIR)/cdf.1 @rm -f $(MANDIR)/cumsum.1 @echo "Uninstallation complete." # Help target .PHONY: help help: @echo "Available targets:" @echo " all - Build all binaries (default)" @echo " build - Create build directories" @echo " clean - Remove build artifacts" @echo " install - Install binaries and man pages to system" @echo " uninstall - Remove installed files from system" @echo " help - Show this help message" @echo "" @echo "Variables:" @echo " PREFIX - Installation prefix (default: /usr/local)" @echo " CC - Compiler (default: clang)" @echo " CFLAGS - Compiler flags"