From 07bedb6ceb6e06808ab5b5ee28e0d095e11a1cd5 Mon Sep 17 00:00:00 2001 From: bryan Date: Thu, 27 Aug 2026 10:49:41 +0200 Subject: Make install work on Windows as well as Linux. Windows copies rg.exe to %USERPROFILE%\.local\bin and skips the man page. Linux still installs to /usr/local/bin and share/man. PREFIX overrides the destination on both. --- config.mk | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'config.mk') diff --git a/config.mk b/config.mk index 845b457..886dedd 100644 --- a/config.mk +++ b/config.mk @@ -3,27 +3,30 @@ VERSION = 1.0 # Customize below to fit your system -# paths -PREFIX = /usr/local -MANPREFIX = ${PREFIX}/share/man +# Install: make install +# Windows: %USERPROFILE%\.local\bin +# Linux: /usr/local/bin +# Override: make PREFIX=... install -# compiler -CC = cc -EXE = LIBS = -# Windows (MinGW-w64): uncomment -# CC = gcc -# EXE = .exe - -# Windows (clang targeting MSVC CRT): uncomment -# CC = clang -# EXE = .exe - ifeq ($(OS),Windows_NT) CC = clang EXE = .exe +PREFIX ?= $(USERPROFILE)/.local +RM = cmd /c del /q +else +CC = cc +EXE = +PREFIX ?= /usr/local +RM = rm -f endif +BINDIR ?= $(PREFIX)/bin +MANPREFIX ?= $(PREFIX)/share/man + +# Windows (MinGW-w64): set CC = gcc instead of clang +# Windows (clang targeting MSVC CRT): default when OS=Windows_NT + CFLAGS = -std=c99 -pedantic -Wall -Wextra -Os LDFLAGS = ${LIBS} -- cgit v1.2.3