mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
do build configuration with variables instead of targets
This commit is contained in:
parent
b4ba845fe3
commit
9e25886694
46
Makefile
46
Makefile
|
@ -9,6 +9,38 @@ CP ?= cp
|
||||||
|
|
||||||
CFLAGS_OPTIMIZATION ?= -O3
|
CFLAGS_OPTIMIZATION ?= -O3
|
||||||
|
|
||||||
|
O_DEBUG := 0
|
||||||
|
O_NORL := 0 # no readline support
|
||||||
|
O_NOLOC := 0 # no locale support
|
||||||
|
|
||||||
|
# convert targets to flags for backwards compatibility
|
||||||
|
ifeq ($(MAKECMDGOALS),debug)
|
||||||
|
O_DEBUG := 1
|
||||||
|
endif
|
||||||
|
ifeq ($(MAKECMDGOALS),norl)
|
||||||
|
O_NORL := 1
|
||||||
|
endif
|
||||||
|
ifeq ($(MAKECMDGOALS),noloc)
|
||||||
|
O_NORL := 1
|
||||||
|
O_NOLOC := 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(O_DEBUG),1)
|
||||||
|
CPPFLAGS += -DDBGMODE
|
||||||
|
CFLAGS += -g
|
||||||
|
LDLIBS += -lrt
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(O_NORL),1)
|
||||||
|
CPPFLAGS += -DNORL
|
||||||
|
else
|
||||||
|
LDLIBS += -lreadline
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(O_NOLOC),1)
|
||||||
|
CPPFLAGS += -DNOLOCALE
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
|
ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
|
||||||
CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw)
|
CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw)
|
||||||
LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs ncursesw)
|
LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs ncursesw)
|
||||||
|
@ -34,16 +66,12 @@ all: $(BIN)
|
||||||
$(SRC): src/nnn.h
|
$(SRC): src/nnn.h
|
||||||
|
|
||||||
$(BIN): $(SRC)
|
$(BIN): $(SRC)
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) -lreadline
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
||||||
|
|
||||||
debug: $(SRC)
|
# targets for backwards compatibility
|
||||||
$(CC) -DDBGMODE -g $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(BIN) $^ $(LDLIBS) -lreadline -lrt
|
debug: $(BIN)
|
||||||
|
norl: $(BIN)
|
||||||
norl: $(SRC)
|
noloc: $(BIN)
|
||||||
$(CC) -DNORL $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(BIN) $^ $(LDLIBS)
|
|
||||||
|
|
||||||
noloc: $(SRC)
|
|
||||||
$(CC) -DNORL -DNOLOCALE $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(BIN) $^ $(LDLIBS)
|
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
$(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin
|
$(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin
|
||||||
|
|
|
@ -81,7 +81,7 @@ Notes:
|
||||||
|
|
||||||
#### Library dependencies
|
#### Library dependencies
|
||||||
|
|
||||||
A curses library with wide char support (e.g. ncursesw), libreadline (`make norl` to drop) and standard libc.
|
A curses library with wide char support (e.g. ncursesw), libreadline (`make O_NORL=1` to drop) and standard libc.
|
||||||
|
|
||||||
#### Utility dependencies
|
#### Utility dependencies
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue