Use target specific pkg-config wrapper if available
parent
de3a86e343
commit
d7eedd0c01
4
Makefile
4
Makefile
|
@ -38,13 +38,13 @@ $(BUILD_DIR)/neatvnc.pc:
|
||||||
BENCH_DIR = $(BUILD_DIR)/bench
|
BENCH_DIR = $(BUILD_DIR)/bench
|
||||||
|
|
||||||
$(BENCH_DIR)/%.o: bench/%.c | $(BENCH_DIR)
|
$(BENCH_DIR)/%.o: bench/%.c | $(BENCH_DIR)
|
||||||
$(CC_OBJ) $(shell pkg-config --cflags libpng)
|
$(CC_OBJ) $(shell $(PKGCONFIG) --cflags libpng)
|
||||||
|
|
||||||
$(BENCH_DIR): ; mkdir -p $@
|
$(BENCH_DIR): ; mkdir -p $@
|
||||||
$(BENCH_DIR)/zrle-bench:
|
$(BENCH_DIR)/zrle-bench:
|
||||||
$(BENCH_DIR)/zrle-bench: $(OBJECTS) $(BUILD_DIR)/pngfb.o \
|
$(BENCH_DIR)/zrle-bench: $(OBJECTS) $(BUILD_DIR)/pngfb.o \
|
||||||
$(BENCH_DIR)/zrle-bench.o
|
$(BENCH_DIR)/zrle-bench.o
|
||||||
$(LINK_EXE) $(shell pkg-config --libs libpng)
|
$(LINK_EXE) $(shell $(PKGCONFIG) --libs libpng)
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: $(DSO) $(BUILD_DIR)/neatvnc.pc
|
install: $(DSO) $(BUILD_DIR)/neatvnc.pc
|
||||||
|
|
10
common.mk
10
common.mk
|
@ -18,6 +18,12 @@ else
|
||||||
STRIP := $(MACHINE)-strip
|
STRIP := $(MACHINE)-strip
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq (, $(shell which $(MACHINE)-pkg-config 2>/dev/null))
|
||||||
|
PKGCONFIG ?= pkg-config
|
||||||
|
else
|
||||||
|
PKGCONFIG ?= $(MACHINE)-pkg-config
|
||||||
|
endif
|
||||||
|
|
||||||
CFLAGS ?= -g -O3 $(ARCH_CFLAGS) -flto -DNDEBUG
|
CFLAGS ?= -g -O3 $(ARCH_CFLAGS) -flto -DNDEBUG
|
||||||
LDFLAGS ?= -flto
|
LDFLAGS ?= -flto
|
||||||
|
|
||||||
|
@ -27,8 +33,8 @@ CC_OBJ = $(CC) -c $(CFLAGS) $< -o $@ -MMD -MP -MF $(@:.o=.deps)
|
||||||
LINK_EXE = $(CC) $^ $(LDFLAGS) -o $@
|
LINK_EXE = $(CC) $^ $(LDFLAGS) -o $@
|
||||||
LINK_DSO = $(CC) -fPIC -shared $^ $(LDFLAGS) -o $@
|
LINK_DSO = $(CC) -fPIC -shared $^ $(LDFLAGS) -o $@
|
||||||
|
|
||||||
CFLAGS += $(foreach dep,$(DEPENDENCIES),$(shell pkg-config --cflags $(dep)))
|
CFLAGS += $(foreach dep,$(DEPENDENCIES),$(shell $(PKGCONFIG) --cflags $(dep)))
|
||||||
LDFLAGS += $(foreach dep,$(DEPENDENCIES),$(shell pkg-config --libs $(dep)))
|
LDFLAGS += $(foreach dep,$(DEPENDENCIES),$(shell $(PKGCONFIG) --libs $(dep)))
|
||||||
OBJECTS := $(SOURCES:src/%.c=$(BUILD_DIR)/%.o)
|
OBJECTS := $(SOURCES:src/%.c=$(BUILD_DIR)/%.o)
|
||||||
|
|
||||||
$(BUILD_DIR): ; mkdir -p $(BUILD_DIR)
|
$(BUILD_DIR): ; mkdir -p $(BUILD_DIR)
|
||||||
|
|
Loading…
Reference in New Issue