neatvnc/Makefile

48 lines
1.2 KiB
Makefile
Raw Normal View History

2019-09-07 13:51:17 +00:00
CFLAGS ?= -g -O3 -mavx -flto -DNDEBUG
LDFLAGS ?= -flto
BUILD_DIR ?= build-$(shell uname -m)
2019-08-27 19:57:52 +00:00
2019-09-07 13:51:17 +00:00
DSO_NAME=libneatvnc
DSO_MAJOR=0
DSO_MINOR=0
2019-08-27 19:57:52 +00:00
2019-09-07 13:51:17 +00:00
DEPENDENCIES := pixman-1 libpng libuv
2019-08-27 19:57:52 +00:00
2019-09-07 13:51:17 +00:00
SOURCES := \
src/server.c \
src/util.c \
src/vec.c \
src/zrle.c \
2019-08-29 22:07:04 +00:00
2019-09-07 13:51:17 +00:00
OBJECTS := $(SOURCES:src/%.c=$(BUILD_DIR)/%.o) $(BUILD_DIR)/miniz.o
2019-08-29 22:07:04 +00:00
2019-09-07 13:51:17 +00:00
CFLAGS += -std=gnu11 -D_GNU_SOURCE -Iinc -fvisibility=hidden -Icontrib/miniz \
$(foreach dep,$(DEPENDENCIES),$(shell pkg-config --cflags $(dep)))
2019-08-27 22:29:46 +00:00
2019-09-07 13:51:17 +00:00
LDFLAGS += $(foreach dep,$(DEPENDENCIES),$(shell pkg-config --libs $(dep)))
2019-08-29 22:07:04 +00:00
2019-09-07 13:51:17 +00:00
DSO_PATH := $(BUILD_DIR)/$(DSO_NAME)
2019-09-07 13:51:17 +00:00
all: $(DSO_PATH).so.$(DSO_MAJOR).$(DSO_MINOR)
2019-08-27 19:57:52 +00:00
2019-09-07 13:51:17 +00:00
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
2019-08-31 15:50:23 +00:00
2019-09-07 13:51:17 +00:00
$(DSO_PATH).so.$(DSO_MAJOR).$(DSO_MINOR): $(OBJECTS)
$(CC) -fPIC -shared $^ $(LDFLAGS) -o $@
ln -sf $(DSO_NAME).so.$(DSO_MAJOR).$(DSO_MINOR) $(DSO_PATH).so.$(DSO_MINOR)
ln -sf $(DSO_NAME).so.$(DSO_MAJOR).$(DSO_MINOR) $(DSO_PATH).so
2019-08-27 22:29:46 +00:00
2019-09-07 13:51:17 +00:00
CC_OBJ = $(CC) -c $(CFLAGS) $< -o $@ $(CC_DEP_ARGS) -MMD -MP -MF $(@:.o=.deps)
$(BUILD_DIR)/%.o: src/%.c | $(BUILD_DIR) ; $(CC_OBJ)
$(BUILD_DIR)/miniz.o: contrib/miniz/miniz.c | $(BUILD_DIR) ; $(CC_OBJ)
2019-08-29 22:07:04 +00:00
2019-08-27 19:57:52 +00:00
.PHONY: clean
clean:
2019-09-07 13:51:17 +00:00
rm -rf $(BUILD_DIR)
2019-08-27 19:57:52 +00:00
2019-09-07 13:51:17 +00:00
-include $(BUILD_DIR)/*.deps
2019-08-27 19:57:52 +00:00
.SUFFIXES:
.SECONDARY: