Fix build env issues with manual build
This commit is contained in:
13
Makefile
13
Makefile
@@ -20,20 +20,29 @@ OBJS_TEST := $(addprefix $(BUILD)/,$(addsuffix .o,config log net proto json ser
|
||||
|
||||
PYTHON ?= python3
|
||||
|
||||
.PHONY: all test test-c test-web install clean docker-test
|
||||
.PHONY: all test test-c test-web install clean docker-test check-deps
|
||||
|
||||
all: $(BUILD)/patchbayd
|
||||
|
||||
$(BUILD):
|
||||
mkdir -p $(BUILD)
|
||||
|
||||
# Fails early with a hint instead of a missing-header compiler error.
|
||||
check-deps:
|
||||
@pkg-config --exists $(PKGS) || { \
|
||||
echo "missing build dependencies (pkg-config cannot find: $(PKGS))" >&2; \
|
||||
echo " APT: sudo apt-get install build-essential pkg-config libssh2-1-dev libsqlite3-dev" >&2; \
|
||||
echo " XBPS: sudo xbps-install base-devel pkg-config libssh2-devel sqlite-devel" >&2; \
|
||||
echo " or: sudo ./install.sh --role client|target (keeps an existing config)" >&2; \
|
||||
exit 1; }
|
||||
|
||||
# Embed schema.sql as a C string so the daemon has no runtime file dependency.
|
||||
$(BUILD)/schema.h: schema.sql | $(BUILD)
|
||||
{ printf 'static const char pb_schema_sql[] =\n'; \
|
||||
sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/\\n"/' $<; \
|
||||
printf ';\n'; } > $@
|
||||
|
||||
$(BUILD)/%.o: $(SRC)/%.c $(wildcard $(SRC)/*.h) $(BUILD)/schema.h | $(BUILD)
|
||||
$(BUILD)/%.o: $(SRC)/%.c $(wildcard $(SRC)/*.h) $(BUILD)/schema.h | $(BUILD) check-deps
|
||||
$(CC) $(CFLAGS) $(PKG_CFLAGS) -I$(BUILD) -c -o $@ $<
|
||||
|
||||
$(BUILD)/patchbayd: $(OBJS_ALL)
|
||||
|
||||
Reference in New Issue
Block a user