Skip to content

Commit

Permalink
switched to makefile (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
btab authored Apr 28, 2020
1 parent f74a3f4 commit 407fef9
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
*.lib
*.obj
*.pdb

build/
58 changes: 58 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
config ?= release

COMPILE_WITH := ponyc

LIB_SRC_DIR := semver
TEST_SRC_DIR := test

LIB_SRC_FILES := $(shell find $(LIB_SRC_DIR) -name "*.pony")
TEST_SRC_FILES := $(shell find $(TEST_SRC_DIR) -name "*.pony")
SRC_FILES := $(LIB_SRC_FILES) $(TEST_SRC_FILES)

BUILD_DIR := build/$(config)
DOCS_DIR := build/docs

TEST_BINARY := $(BUILD_DIR)/test
ifeq ( ,$(WINDIR))
TEST_BINARY_TARGET := $(TEST_BINARY)
else
TEST_BINARY_TARGET := $(TEST_BINARY).exe
endif

ifdef config
ifeq (,$(filter $(config),debug release))
$(error Unknown configuration "$(config)")
endif
endif

ifeq ($(config),release)
PONYC = $(COMPILE_WITH)
else
PONYC = $(COMPILE_WITH) --debug
endif

test: $(TEST_BINARY_TARGET)
$^ --noprog

$(TEST_BINARY_TARGET): $(SRC_FILES) | $(BUILD_DIR)
$(PONYC) -b $(TEST_BINARY) $(TEST_SRC_DIR)

clean:
rm -rf $(BUILD_DIR)

realclean:
rm -rf build

# FIXME: this target is currently broken
$(DOCS_DIR): $(LIB_SRC_FILES)
rm -rf $(DOCS_DIR)
$(PONYC) --docs-public --pass=docs --output $(DOCS_DIR) $(LIB_SRC_FILES)

docs: $(DOCS_DIR)

all: test

$(BUILD_DIR):
mkdir -p $(BUILD_DIR)

.PHONY: all clean docs realclean test
3 changes: 0 additions & 3 deletions test.sh

This file was deleted.

0 comments on commit 407fef9

Please sign in to comment.