summaryrefslogtreecommitdiff
path: root/config.mk
diff options
context:
space:
mode:
authorbryan <bryan@veltar.systems>2026-08-27 10:49:41 +0200
committerbryan <bryan@veltar.systems>2026-08-27 10:49:41 +0200
commit07bedb6ceb6e06808ab5b5ee28e0d095e11a1cd5 (patch)
treeb62884a2ddb560e84ac1dae3b48ce432153a5271 /config.mk
parent22ade138c4e83b7c0b0c702c38c0ca00a9948d4b (diff)
downloadrg-master.tar.gz
rg-master.zip
Make install work on Windows as well as Linux.HEADmaster
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.
Diffstat (limited to 'config.mk')
-rw-r--r--config.mk31
1 files changed, 17 insertions, 14 deletions
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}