1 CC_VERSION := $(shell $(CC) --version | \
2 sed -n -e '/clang-/s/.*clang-\([0-9][0-9]*\).*/\1/p')
10 # Warnings are version-dependent, unfortunately,
11 # so test for version before adding a -W flag.
12 # Note: gnu make requires $(shell test ...) for "a > b" type tests.
13 ifeq ($(shell test $(CC_VERSION) -gt 0; echo $$?),0)
14 WFLAGS += -Weverything
16 WFLAGS += -Wno-gnu-zero-variadic-macro-arguments
17 WFLAGS += -Wno-format-nonliteral
18 WFLAGS += -Wno-unused-macros
19 WFLAGS += -Wno-disabled-macro-expansion
23 ifeq ($(shell test $(CC_VERSION) -gt 600; echo $$?),0)
24 WFLAGS += -Wno-reserved-id-macro
31 # Note: to turn on debug, use -DL9P_DEBUG=L9P_DEBUG,
32 # and set env variable LIB9P_LOGGING to stderr or to
33 # the (preferably full path name of) the debug log file.
53 LIB_OBJS := $(addprefix build/,$(LIB_SRCS:.c=.o))
54 SERVER_OBJS := $(SERVER_SRCS:.c=.o)
58 all: build $(LIB) $(SERVER)
61 cc -dynamiclib $^ -o build/$@
63 $(SERVER): $(SERVER_OBJS) $(LIB)
64 cc $< -o build/$(SERVER) -Lbuild/ -l9p
76 $(CC) $(CFLAGS) -c $< -o $@