Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up top-level build rules #24

Merged
merged 1 commit into from
Mar 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SRC ?= ./src
OUT ?= ./build
SRC := src

CFLAGS = -Os -fPIC -g
LDFLAGS = -lpthread
Expand Down Expand Up @@ -57,14 +57,11 @@ OBJS += \
endif

OBJS := $(addprefix $(OUT)/, $(OBJS))
deps := $(OBJS:%.o=%.o.d)

SHELL_HACK := $(shell mkdir -p $(OUT))
SHELL_HACK := $(shell mkdir -p $(addprefix $(OUT)/,jni))
#deps := $(OBJS:%.o=%.o.d)

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

$(OUT)/%.o: $(SRC)/%.c
$(VECHO) " CC\t$@\n"
Expand All @@ -83,16 +80,6 @@ $(OUT)/test-multi_pow_%: tests/test-multi_pow_%.py $(OUT)/libdcurl.so
$(call py_prepare_cmd)
$(Q)chmod +x $@

$(OUT)/test-%.done: $(OUT)/test-%
$(Q)$(PRINTF) "*** Validating $< ***\n"
$(Q)./$< && $(PRINTF) "\t$(PASS_COLOR)[ Verified ]$(NO_COLOR)\n"
check: $(addsuffix .done, $(TESTS))

clean:
$(RM) -r $(OUT)
distclean: clean
$(RM) local.mk

include mk/common.mk
include mk/python.mk
-include $(deps)
32 changes: 24 additions & 8 deletions mk/common.mk
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
# Always ensure directory build exist
SHELL_HACK := $(shell mkdir -p $(OUT))

UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
PRINTF = printf
else
PRINTF = env printf
endif

# Control the build verbosity
ifeq ("$(VERBOSE)","1")
Q :=
VECHO = @true
else
Q := @
VECHO = @printf
VECHO = @$(PRINTF)
endif

# dependency of source files
deps := $(OBJS:%.o=%.o.d)

# Test suite
PASS_COLOR = \e[32;01m
NO_COLOR = \e[0m

UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
PRINTF = printf
else
PRINTF = env printf
endif
$(OUT)/test-%.done: $(OUT)/test-%
$(Q)$(PRINTF) "*** Validating $< ***\n"
$(Q)./$< && $(PRINTF) "\t$(PASS_COLOR)[ Verified ]$(NO_COLOR)\n"
check: $(addsuffix .done, $(TESTS))

config: $(OUT)/config-timestamp

$(OUT)/config-timestamp: $(OUT)/local.mk
$(Q)touch $@
$(OUT)/local.mk:
$(Q)cp -f mk/defs.mk $@

clean:
$(RM) -r $(OUT)
distclean: clean
$(RM) local.mk
1 change: 1 addition & 0 deletions mk/java.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ifndef CURL
$(error "curl is not available.")
endif

SHELL_HACK := $(shell mkdir -p $(addprefix $(OUT)/,jni))
SHELL_HACK := $(shell mkdir -p $(OUT)/com/iota/iri/hash)

GITHUB_REPO ?= chenwei-tw/iri/feat/new_pow_interface
Expand Down