Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 90 lines (74 sloc) 2.574 kb
823f1cb @cedricss Initial commit
authored
1 ########################################
2 # MAKEFILE VARIABLES
3 OPACOMPILER ?= opa
4 OPA = $(OPACOMPILER) $(FLAG) $(OPAOPT)
5 PWD ?= $(shell pwd)
6 BUILDDIR ?= $(PWD)/_build
7 export BUILDDIR
8 BUILDDOCDIR ?=$(PWD)/doc/
9 export BUILDDOCDIR
10 PACKDOC = $(BUILDDOCDIR)/$(PACKNAME:%.opx=%.doc)/
11 BUILDDOC = $(PACKDOC)
12 OPAGENAPI ?= $(OPACOMPILER) --api-only
13 OPADOC ?= opadoc-gen.exe
14 DEPENDS = $(SRC) $(PCK:%=$(BUILDDIR)/%) $(PLUGIN:%=$(BUILDDIR)/%)
15
16 ifdef CONF_FILE
17 CONFIG = --conf $(CONF_FILE) --conf-opa-files
18 else
19 CONFIG =
20 endif
21
22 _ = $(shell mkdir -p $(BUILDDIR))
23
24 ########################################
25 # MAIN RULE
26 exe : $(EXE)
27 pack : $(PACKNAME)
28 doc : $(PACKDOC) doc.sub
29
30 ########################################
31 # MAIN PACKAGE BUILDING
32 $(PACKNAME) : $(BUILDDIR)/$(PACKNAME)
33
34 $(BUILDDIR)/$(PACKNAME) : $(DEPENDS)
35 @echo "### Building package $(PACKNAME)"
36 mkdir -p $(BUILDDIR)
37 $(OPA) --autocompile $(SRC) $(PLUGIN:%=$(BUILDDIR)/%) --build-dir $(BUILDDIR) -I $(BUILDDIR) $(OPAOPT)
38 @rm -rf $(BUILDDIR)/$(PACKNAME)
39 @mv $(PACKNAME) $(BUILDDIR)/
40
41 ########################################
42 # SUBS PACKAGE/PLUGIN BUILDING
43 $(BUILDDIR)/%.opx :
44 make $(@:$(BUILDDIR)/%.opx=-C $(PCKDIR)/%) pack
45
46 $(BUILDDIR)/%.opp :
47 make $(@:$(BUILDDIR)/%.opp=-C $(PLUGINDIR)/%)
48
49 ########################################
50 # EXECUTABLE BUILDING
51 $(EXE) : pack $(SRC) $(MAINSRC) $(DEPENDS) $(OTHER_DEPENDS)
52 @echo "### Building executable $(EXE) "
53 mkdir -p $(BUILDDIR)
54 $(OPA) $(COMPILOPT) $(MAINSRC) $(CONFIG) $(PLUGIN:%=$(BUILDDIR)/%) -o $@ -I $(BUILDDIR) --build-dir $(BUILDDIR)/$(EXE)
55
56 $(EXE:%.exe=%.run) : $(EXE)
57 ./$(EXE) -p $(PORT)
58
59 ########################################
60 # DOCUMENTATION BUILDING - Dirty...
61 $(PACKDOC) :
62 @echo "### Building documentation $(PACKNAME:%.opx=%.doc)"
63 @mkdir -p $(BUILDDOC)
64 @$(OPACOMPILER) $(SRC) $(PLUGIN:%=$(BUILDDIR)/%) --api-only -I $(BUILDDIR)
65 @mv $(SRC:%=%.api) $(SRC:%=%.api-txt) $(BUILDDOC)
66 @cp $(SRC) $(BUILDDOC)
67 @cd $(BUILDDOC) && $(OPADOC) .
68 @mkdir -p $(PACKDOC)
69 @mv doc/*.html doc/*.css $(PACKDOC)
70
71 doc.sub :
72 @if [ -n "$(PCK)" ]; then make $(PCK:%.opx=-C $(PCKDIR)/%) doc; fi
73
74 ########################################
75 # Used by recursives makefile
76 pack.depends :
77 @echo $(PCK) $(PLUGIN)
78
79 ########################################
80 # CLEANING
81 clean ::
82 @$(PCK:%.opx=make -C $(PCKDIR)/% clean &&) $(PLUGIN:%.opp=make -C $(PLUGINDIR)/% clean &&) echo "### Cleaning $(BUILDDIR)";
83 @rm -rf $(BUILDDIR)/* _tracks/*;
84 @if [ -n "$(EXE)" ]; then rm -rf $(EXE); fi
85 @if [ -n "$(PACKDOC)" ]; then rm -rf $(PACKDOC); fi
86
87 deep-clean: clean
88 @rm -rf opa-debug/*
89
Something went wrong with that request. Please try again.