$NetBSD: patch-src_Makefile,v 1.5 2025/02/13 16:43:50 vins Exp $ - Make libdl and curses flags overridable - Make color, threads and x11 support opt in so we can control it - Remove hardcoded paths for NetBSD --- src/Makefile.orig 2024-08-16 14:46:09.000000000 +0000 +++ src/Makefile @@ -2,14 +2,14 @@ name = sc-im # The base directory where everything should be installed. -prefix = /usr/local +prefix = @PREFIX@ EXDIR = $(prefix)/bin HELPDIR = $(prefix)/share/$(name) LIBDIR = $(prefix)/share/doc/$(name) # This is where the man page goes. -MANDIR = $(prefix)/share/man/man1 +MANDIR = @PREFIX@/@PKGMANDIR@/man1 # History directory, relative to $HOME HISTORY_DIR= .cache @@ -19,9 +19,9 @@ CONFIG_DIR= .config/sc-im CONFIG_FILE=scimrc # Change these to your liking or use `make CC=gcc` etc -#CC = cc -#YACC = bison -y -#SED = sed +CC = @CC@ +YACC = @YACC@ +SED = @SED@ LDLIBS += -lm @@ -37,7 +37,7 @@ CFLAGS += -DDFLT_PAGER=\"less\" # Sets default editor. Its use in case EDITOR env variable is not set CFLAGS += -DDFLT_EDITOR=\"vim\" # Comment out to disable color support -CFLAGS += -DUSECOLORS +#CFLAGS += -DUSECOLORS # Command history file, relative to HISTORY_DIR directory. Comment out to disable commandline history CFLAGS += -DHISTORY_FILE=\"$(HISTORY_FILE)\" -DHISTORY_DIR=\"$(HISTORY_DIR)\" # Configuration file, relative to CONFIG_DIR directory @@ -60,14 +60,14 @@ CFLAGS += -DMOUSE #to copy to tmux clipboard: #CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""tmux load-buffer"\" #to copy to X clipboard: -CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""xclip -i -selection clipboard <"\" +#CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""xclip -i -selection clipboard <"\" #to copy to OSX clipboard: #CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""pbcopy <"\" # # Choose one of the proposed commands for pasting from different clipboards: # You can later change it at runtime. #CFLAGS += -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""tmux show-buffer"\" -CFLAGS += -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""xclip -o -selection clipboard"\" +#CFLAGS += -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""xclip -o -selection clipboard"\" #CFLAGS += -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""pbpaste"\" # Command to open file or link under cursor @@ -76,11 +76,7 @@ CFLAGS += -DDEFAULT_OPEN_FILE_UNDER_CURS # Autobackup. If you unset this, no backup check nor autobackup feature will be available. CFLAGS += -DAUTOBACKUP # Have threads? Set these two, if you want the autobackup feature to work with threads. -CFLAGS += -DHAVE_PTHREAD - -ifneq ($(shell uname -s),Darwin) - LDLIBS += -pthread -endif +#CFLAGS += -DHAVE_PTHREAD # Check for gnuplot existence ifneq (, $(shell which gnuplot)) @@ -94,22 +90,24 @@ endif # dynamic linking (not available in BSD) ifneq ($(shell uname -s | grep -o BSD),BSD) - LDLIBS += -ldl + LDLIBS_DL += -ldl endif +LDLIBS += $(LDLIBS_DL) + ifneq (, $(shell which pkg-config)) # Any system with pkg-config # NOTE: ncursesw (required) ifneq ($(shell pkg-config --exists ncursesw || echo 'no'),no) - CFLAGS += $(shell pkg-config --cflags ncursesw) - LDLIBS += $(shell pkg-config --libs ncursesw) + CFLAGS_CURSES ?= $(shell pkg-config --cflags ncursesw) + LDLIBS_CURSES += $(shell pkg-config --libs ncursesw) else ifneq ($(shell pkg-config --exists ncurses || echo 'no'),no) # hopefully this includes wide character support then - CFLAGS += $(shell pkg-config --cflags ncurses) - LDLIBS += $(shell pkg-config --libs ncurses) + CFLAGS_CURSES ?= $(shell pkg-config --cflags ncurses) + LDLIBS_CURSES ?= $(shell pkg-config --libs ncurses) else - LDLIBS += -lncursesw + LDLIBS_CURSES ?= -lncursesw endif # NOTE: libxlsreader (libxls) is required for xls file reading support @@ -148,19 +146,14 @@ ifneq (, $(shell which pkg-config)) endif endif else ifeq ($(shell uname -s),NetBSD) - # NetBSD without pkg-config - - CFLAGS += -I/usr/pkg/include - CFLAGS += -I/usr/pkg/include/ncursesw - - LDFLAGS += -L/usr/pkg/lib - LDFLAGS += -Wl,-R/usr/pkg/lib - - LDLIBS += -lncursesw + LDLIBS_CURSES += -lncurses else - LDFLAGS += -lncursesw + LDLIBS_CURSES += -lncursesw endif +CFLAGS += $(CFLAGS_CURSES) +LDLIBS += $(LDLIBS_CURSES) + OBJS = $(patsubst %.c, %.o, $(wildcard *.c) $(wildcard actions/*.c) $(wildcard formats/*.c) $(wildcard cmds/*.c) $(wildcard utils/*.c)) gram.o .PHONY : all clean install docs man_install man_uninstall @@ -201,10 +194,10 @@ gram.c : y.tab.c y.tab.h : gram.y | gram.c experres.h : gram.y eres.sed - sed -f eres.sed < $< > $@ + $(SED) -f eres.sed < $< > $@ statres.h : gram.y sres.sed - sed -f sres.sed < $< > $@ + $(SED) -f sres.sed < $< > $@ pvmtbl.o: sc.h pvmtbl.c $(CC) ${CFLAGS} -c -DPSC pvmtbl.c