Build examples

tight-png
Andri Yngvason 2019-09-07 15:59:48 +00:00
parent 8374267955
commit 378809bad2
3 changed files with 32 additions and 1 deletions

View File

@ -22,4 +22,11 @@ $(DSO_PATH).so.$(DSO_MAJOR).$(DSO_MINOR): $(OBJECTS)
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.$(DSO_MINOR)
ln -sf $(DSO_NAME).so.$(DSO_MAJOR).$(DSO_MINOR) $(DSO_PATH).so ln -sf $(DSO_NAME).so.$(DSO_MAJOR).$(DSO_MINOR) $(DSO_PATH).so
$(BUILD_DIR)/%.o: src/%.c | $(BUILD_DIR) ; $(CC_OBJ)
$(BUILD_DIR)/miniz.o: contrib/miniz/miniz.c | $(BUILD_DIR) ; $(CC_OBJ) $(BUILD_DIR)/miniz.o: contrib/miniz/miniz.c | $(BUILD_DIR) ; $(CC_OBJ)
.PHONY: examples
examples:
make -C examples \
BUILD_DIR=../$(BUILD_DIR)/examples \
LIB_PATH=../$(BUILD_DIR)

View File

@ -16,6 +16,7 @@ LDFLAGS ?= -flto
CFLAGS += -std=gnu11 -D_GNU_SOURCE -Iinc CFLAGS += -std=gnu11 -D_GNU_SOURCE -Iinc
CC_OBJ = $(CC) -c $(CFLAGS) $< -o $@ -MMD -MP -MF $(@:.o=.deps) CC_OBJ = $(CC) -c $(CFLAGS) $< -o $@ -MMD -MP -MF $(@:.o=.deps)
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 pkg-config --cflags $(dep)))
@ -23,7 +24,6 @@ LDFLAGS += $(foreach dep,$(DEPENDENCIES),$(shell pkg-config --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)
$(BUILD_DIR)/%.o: src/%.c | $(BUILD_DIR) ; $(CC_OBJ)
.PHONY: clean .PHONY: clean
clean: ; rm -rf $(BUILD_DIR) clean: ; rm -rf $(BUILD_DIR)

24
examples/Makefile 100644
View File

@ -0,0 +1,24 @@
DEPENDENCIES := libpng pixman-1 libuv
include ../common.mk
ifdef LIB_PATH
LDFLAGS += -L$(LIB_PATH) -Wl,-rpath=$(shell pwd)/$(LIB_PATH)
endif
LDFLAGS += -lneatvnc
all: \
$(BUILD_DIR)/png-server \
$(BUILD_DIR)/draw \
$(BUILD_DIR)/png-server: $(BUILD_DIR)/png-server.o $(BUILD_DIR)/pngfb.o
$(LINK_EXE)
$(BUILD_DIR)/draw: $(BUILD_DIR)/draw.o ; $(LINK_EXE)
$(BUILD_DIR)/%.o: %.c | $(BUILD_DIR) ; $(CC_OBJ) -I../inc
$(BUILD_DIR)/pngfb.o: ../src/pngfb.c | $(BUILD_DIR)
$(CC_OBJ) -I../inc