Skip to content

Commit

Permalink
Merge pull request #170 from marktwtn/remote-exclude-rabbitmq
Browse files Browse the repository at this point in the history
build: Exclude RabbitMQ when BUILD_REMOTE is off
  • Loading branch information
jserv committed Jul 19, 2019
2 parents 0a89852 + f6cf152 commit 13b9624
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ LIBS := $(addprefix $(OUT)/, $(LIBS))
JARS := dcurljni-$(VERSION).jar
JARS := $(addprefix $(OUT)/, $(JARS))

PREQ := config $(TESTS) $(LIBS)
PREQ := $(SUBS) config $(TESTS) $(LIBS)
ifeq ("$(BUILD_JNI)","1")
PREQ += $(JARS)
endif
Expand Down Expand Up @@ -162,19 +162,19 @@ endif

OBJS := $(addprefix $(OUT)/, $(OBJS))

$(OUT)/test-%.o: tests/test-%.c $(LIBTUV_PATH)/include
$(OUT)/test-%.o: tests/test-%.c
$(VECHO) " CC\t$@\n"
$(Q)$(CC) -o $@ $(CFLAGS) -I $(SRC) $(LIBTUV_INCLUDE) -c -MMD -MF $@.d $<
$(Q)$(CC) -o $@ $(CFLAGS) -I $(SRC) $(SUB_INCLUDE) -c -MMD -MF $@.d $<

$(OUT)/%.o: $(SRC)/%.c $(LIBTUV_PATH)/include $(LIBRABBITMQ_PATH)/build/include
$(OUT)/%.o: $(SRC)/%.c $(SUB_OBJS)
$(VECHO) " CC\t$@\n"
$(Q)$(CC) -o $@ $(CFLAGS) $(LIBTUV_INCLUDE) $(LIBRABBITMQ_INCLUDE) -c -MMD -MF $@.d $<
$(Q)$(CC) -o $@ $(CFLAGS) $(SUB_INCLUDE) -c -MMD -MF $@.d $<

$(OUT)/test-%: $(OUT)/test-%.o $(OBJS) $(LIBTUV_OBJS) $(LIBRABBITMQ_OBJS)
$(OUT)/test-%: $(OUT)/test-%.o $(OBJS) $(SUB_OBJS)
$(VECHO) " LD\t$@\n"
$(Q)$(CC) -o $@ $^ $(LDFLAGS)

$(OUT)/libdcurl.so: $(OBJS) $(LIBTUV_OBJS) $(LIBRABBITMQ_OBJS)
$(OUT)/libdcurl.so: $(OBJS) $(SUB_OBJS)
$(VECHO) " LD\t$@\n"
$(Q)$(CC) -shared -o $@ $^ $(LDFLAGS)

Expand Down
2 changes: 1 addition & 1 deletion mk/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ NO_COLOR = \e[0m
$(OUT)/test-%.done: $(OUT)/test-%
$(Q)$(PRINTF) "*** Validating $< ***\n"
$(Q)./$< && $(PRINTF) "\t$(PASS_COLOR)[ Verified ]$(NO_COLOR)\n"
check: $(addsuffix .done, $(TESTS))
check: $(SUBS) $(addsuffix .done, $(TESTS))

config: $(OUT)/config-timestamp

Expand Down
6 changes: 3 additions & 3 deletions mk/remote.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Build remote-worker
$(OUT)/worker-%.o: $(SRC)/%.c $(LIBTUV_PATH)/include $(LIBRABBITMQ_PATH)/build/include
$(OUT)/worker-%.o: $(SRC)/%.c
$(VECHO) " CC\t$@\n"
$(Q)$(CC) -o $@ $(WORKER_CFLAGS) $(LIBTUV_INCLUDE) $(LIBRABBITMQ_INCLUDE) -c -MMD -MF $@.d $<
$(Q)$(CC) -o $@ $(WORKER_CFLAGS) $(SUB_INCLUDE) -c -MMD -MF $@.d $<

$(OUT)/remote-worker: $(OUT)/remote_worker.o $(WORKER_OBJS) $(LIBTUV_OBJS) $(LIBRABBITMQ_OBJS)
$(OUT)/remote-worker: $(OUT)/remote_worker.o $(WORKER_OBJS) $(SUB_OBJS)
$(VECHO) " LD\t$@\n"
$(Q)$(CC) -o $@ $^ $(LDFLAGS)
24 changes: 20 additions & 4 deletions mk/submodule.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ ifeq ($(UNAME_S),darwin)
LDFLAGS += -L$(OPENSSL_PATH)/lib -lcrypto -lssl
endif

$(LIBRABBITMQ_PATH)/build/include:
$(LIBRABBITMQ_PATH)/librabbitmq:
git submodule update --init $(LIBRABBITMQ_PATH)
mkdir $(LIBRABBITMQ_PATH)/build

$(LIBRABBITMQ_OBJS):
mkdir -p $(LIBRABBITMQ_PATH)/build
ifeq ($(UNAME_S),darwin)
# macOS
cd $(LIBRABBITMQ_PATH)/build && \
Expand All @@ -49,7 +51,21 @@ else
cmake -DCMAKE_INSTALL_PREFIX=. .. && \
cmake --build . --target install
endif

$(LIBRABBITMQ_OBJS):
cd $(LIBRABBITMQ_PATH)/build && \
cmake --build .

# Submodules
SUBS := $(LIBTUV_PATH)/include
ifeq ($(BUILD_REMOTE),1)
SUBS += $(LIBRABBITMQ_PATH)/librabbitmq
endif
# Submodule related objects
SUB_OBJS := $(LIBTUV_OBJS)
ifeq ($(BUILD_REMOTE),1)
SUB_OBJS += $(LIBRABBITMQ_OBJS)
endif
# Submodule C flags for including header files
SUB_INCLUDE := $(LIBTUV_INCLUDE)
ifeq ($(BUILD_REMOTE),1)
SUB_INCLUDE += $(LIBRABBITMQ_INCLUDE)
endif

0 comments on commit 13b9624

Please sign in to comment.