Minor: allow overriding CFLAGS with command line

This commit is contained in:
Nikita Ivanov 2022-09-02 01:45:12 +05:00
parent a4b95979b5
commit 5d96d12b51
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133

View File

@ -8,11 +8,10 @@ DEP := $(OBJ:.o=.d)
PRE := $(wildcard sh/prev/*)
GEN := gen/previews.h gen/server.h gen/helpers.h
O := -O2
LIBS := magic crypto
CFLAGS += $(O) -MD -Wall -Wextra -Wno-unused-parameter
LDFLAGS += $(addprefix -l,$(LIBS))
ALL_CFLAGS := -O2 -MD -Wall -Wextra -Wno-unused-parameter $(CFLAGS) $(CPPFLAGS)
ALL_LDFLAGS := $(addprefix -l,$(LIBS)) $(CFLAGS) $(LDFLAGS)
INSTALL := install
@ -20,8 +19,8 @@ all: ctpv
options:
@echo "CC = $(CC)"
@echo "CFLAGS = $(CFLAGS)"
@echo "LDFLAGS = $(LDFLAGS)"
@echo "CFLAGS = $(ALL_CFLAGS)"
@echo "LDFLAGS = $(ALL_LDFLAGS)"
install: install.bin install.man
@ -47,7 +46,10 @@ docs: README.md doc/ctpv.1
deptable/list.awk $(PRE) | deptable/roff.sed | deptable/insert.awk doc/ctpv.1
ctpv: $(OBJ)
$(CC) -o $@ $+ $(LDFLAGS)
$(CC) -o $@ $+ $(ALL_LDFLAGS)
.c.o:
$(CC) -o $@ $< -c $(ALL_CFLAGS)
# Exclicit rules for generated header files
src/ctpv.o: gen/previews.h