Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

87 lines (72 sloc) 2.522 kB
########################################
# MAKEFILE VARIABLES
OPA = $(OPACOMPILER) $(FLAG) $(OPAOPT)
PWD ?= $(shell pwd)
BUILDDIR ?= $(PWD)/_build
export BUILDDIR
BUILDDOCDIR ?=$(PWD)/doc/
export BUILDDOCDIR
PACKDOC = $(BUILDDOCDIR)/$(PACKNAME:%.opx=%.doc)/
BUILDDOC = $(PACKDOC)
OPACOMPILER ?= opa
OPAGENAPI ?= $(OPACOMPILER) --api-only
OPADOC ?= opadoc-gen.exe
DEPENDS = $(SRC) $(PCK:%=$(BUILDDIR)/%) $(PLUGIN:%=$(BUILDDIR)/%)
ifdef CONF_FILE
CONFIG = --conf $(CONF_FILE)
else
CONFIG =
endif
_ = $(shell mkdir -p $(BUILDDIR))
########################################
# MAIN RULE
exe : $(EXE)
pack : $(PACKNAME)
doc : $(PACKDOC) doc.sub
########################################
# MAIN PACKAGE BUILDING
$(PACKNAME) : $(BUILDDIR)/$(PACKNAME)
$(BUILDDIR)/$(PACKNAME) : $(DEPENDS)
@echo "### Building package $(PACKNAME)"
mkdir -p $(BUILDDIR)
$(OPA) --autocompile $(SRC) $(PLUGIN:%=$(BUILDDIR)/%) --build-dir $(BUILDDIR) -I $(BUILDDIR) $(OPAOPT)
@rm -rf $(BUILDDIR)/$(PACKNAME)
@mv $(PACKNAME) $(BUILDDIR)/
########################################
# SUBS PACKAGE/PLUGIN BUILDING
$(BUILDDIR)/%.opx :
make $(@:$(BUILDDIR)/%.opx=-C $(PCKDIR)/%) pack
$(BUILDDIR)/%.opp :
make $(@:$(BUILDDIR)/%.opp=-C $(PLUGINDIR)/%)
########################################
# EXECUTABLE BUILDING
$(EXE) : pack $(SRC) $(MAINSRC) $(DEPENDS) $(OTHER_DEPENDS)
@echo "### Building executable $(EXE) "
mkdir -p $(BUILDDIR)
$(OPA) $(COMPILOPT) $(MAINSRC) $(CONFIG) $(PLUGIN:%=$(BUILDDIR)/%) -o $@ -I $(BUILDDIR) --build-dir $(BUILDDIR)/$(EXE)
$(EXE:%.exe=%.run) : $(EXE)
./$(EXE) -p $(PORT)
########################################
# DOCUMENTATION BUILDING - Dirty...
$(PACKDOC) :
@echo "### Building documentation $(PACKNAME:%.opx=%.doc)"
@mkdir -p $(BUILDDOC)
@$(OPACOMPILER) $(SRC) $(PLUGIN:%=$(BUILDDIR)/%) --api-only -I $(BUILDDIR)
@mv $(SRC:%=%.api) $(SRC:%=%.api-txt) $(BUILDDOC)
@cp $(SRC) $(BUILDDOC)
@cd $(BUILDDOC) && $(OPADOC) .
@mkdir -p $(PACKDOC)
@mv doc/*.html doc/*.css $(PACKDOC)
doc.sub :
@if [ -n "$(PCK)" ]; then make $(PCK:%.opx=-C $(PCKDIR)/%) doc; fi
########################################
# Used by recursives makefile
pack.depends :
@echo $(PCK) $(PLUGIN)
########################################
# CLEANING
clean ::
@$(PCK:%.opx=make -C $(PCKDIR)/% clean &&) $(PLUGIN:%.opp=make -C $(PLUGINDIR)/% clean &&) echo "### Cleaning $(BUILDDIR)";
@rm -rf $(BUILDDIR) _tracks *.broken;
@if [ -n "$(EXE)" ]; then rm -rf $(EXE); fi
@if [ -n "$(PACKDOC)" ]; then rm -rf $(PACKDOC); fi
Jump to Line
Something went wrong with that request. Please try again.