diff options
| author | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2025-09-19 16:53:49 -0400 |
|---|---|---|
| committer | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2025-09-19 16:53:49 -0400 |
| commit | 44aa2be93d86e5bac3768962f4fea14a4b3778d3 (patch) | |
| tree | 2490fb723baab988a48ff5fb5dfaadfb924b2548 /Makefile | |
| parent | 094184621b0bcc27c2a977ee0dd8bdd9931ec448 (diff) | |
| download | math-utils-44aa2be93d86e5bac3768962f4fea14a4b3778d3.tar.gz | |
Makefile updates
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 70 |
1 files changed, 60 insertions, 10 deletions
@@ -1,19 +1,69 @@ +# 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 -.PHONY: build +# Directory creation targets +bin: + @mkdir -p bin + build: - -mkdir bin - -mkdir build - -bin/cdf: build src/cdf.c include/cdf.h - clang -std=c2x -Iinclude src/cdf.c -o bin/cdf + @mkdir -p build + +# Build targets +bin/cdf: bin src/cdf.c include/cdf.h + $(CC) $(CFLAGS) src/cdf.c -o bin/cdf -bin/cumsum: src/cumsum.c include/cumsum.h - clang -std=c2x -Iinclude src/cumsum.c -o bin/cumsum +bin/cumsum: bin src/cumsum.c include/cumsum.h + $(CC) $(CFLAGS) src/cumsum.c -o bin/cumsum +# Clean target .PHONY: clean clean: - -rm -r bin - -rm -r build + @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)/ + @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 + @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" |