1 ARGEO_BUILD_BASE
:= $(dir $(lastword
$(MAKEFILE_LIST
)))
2 include $(ARGEO_BUILD_BASE
)common.mk
4 # The following variables should be declared in the including Makefile:
5 # BUNDLES the space-separated list of bundles to build
6 # A2_CATEGORY the (single) a2 category the bundles will belong to
8 # The following environment variables can change the behaviour of the build
9 # SOURCE_BUNDLES sources will be packaged separately in Eclipse-compatible source bundles
10 # NO_MANIFEST_COPY generated MANIFESTs won't be copied to the source tree
12 # The following variables have default values which can be overriden
13 # DEP_CATEGORIES the a2 categories the compilation depends on
14 # JAVADOC_PACKAGES the space-separated list of packages for which javadoc will be generated
15 # NATIVE_PACKAGES the space-separated list of JNI packages (directories)
20 # We always use the latest version of the ECJ compiler
21 ECJ_JAR ?
= $(firstword $(foreach base
, $(A2_BASE
), $(sort $(wildcard $(base
)/org.argeo.tp.build
/org.eclipse.jdt.core.compiler.batch.
$(ECJ_MAJOR
).
*.jar
))))
22 # Third-party libraries
23 LOGGER_JAR ?
= $(firstword $(foreach base
, $(A2_BASE
), $(wildcard $(base
)/log
/syslogger
/org.argeo.tp
/org.argeo.tp.syslogger.
$(SYSLOGGER_BRANCH
).jar
)))
24 BNDLIB_JAR ?
= $(firstword $(foreach base
, $(A2_BASE
), $(wildcard $(base
)/org.argeo.tp.build
/biz.aQute.bndlib.
$(BNDLIB_BRANCH
).jar
)))
27 ARGEO_MAKE
= $(JVM
) -cp
$(LOGGER_JAR
):$(ECJ_JAR
):$(BNDLIB_JAR
) $(ARGEO_BUILD_BASE
)src
/org
/argeo
/build
/Make.java
28 JAVADOC_SRCS
= $(foreach bundle
, $(BUNDLES
), $(bundle
)/src
)
29 ifneq ($(NO_MANIFEST_COPY
),true
)
30 MANIFESTS
= $(foreach bundle
, $(BUNDLES
), $(bundle
)/META-INF
/MANIFEST.MF
)
32 BUILD_BASE
= $(SDK_BUILD_BASE
)/$(shell basename $(SDK_SRC_BASE
))
33 TARGET_BUNDLES
= $(abspath
$(foreach bundle
, $(BUNDLES
),$(A2_OUTPUT
)/$(shell dirname
$(bundle
))/$(A2_CATEGORY
)/$(shell basename $(bundle
)).
$(major
).
$(minor
).jar
))
34 TODOS
= $(foreach bundle
, $(BUNDLES
),$(BUILD_BASE
)/$(bundle
)/to-build
)
36 JNIDIRS
=$(foreach package
, $(NATIVE_PACKAGES
), jni
/$(package
))
38 # Needed in order to be able to expand $$ variables
41 osgi
: $(BUILD_BASE
)/built
$(MANIFESTS
)
43 # Actual build (compilation + bundle packaging)
44 $(BUILD_BASE
)/built
: BUNDLES_TO_BUILD
= $(strip $(subst $(abspath
$(BUILD_BASE
))/,, $(subst to-build
,, $?
)))
45 $(BUILD_BASE
)/built
: $(TODOS
)
46 @echo
"| A2 category : $(A2_CATEGORY)"
47 @echo
"| Bundles : $(BUNDLES_TO_BUILD)"
48 @echo
"| Dependencies : $(DEP_CATEGORIES)"
49 @echo
"| Compiler : $(notdir $(ECJ_JAR))"
51 all --a2-bases
$(A2_BASE
) --dep-categories
$(DEP_CATEGORIES
) \
52 --category
$(A2_CATEGORY
) --bundles
$(BUNDLES_TO_BUILD
)
53 @touch
$(BUILD_BASE
)/built
55 $(A2_OUTPUT
)/%.
$(major
).
$(minor
).jar
: $(BUILD_BASE
)/$$(subst $(A2_CATEGORY
)/,,$$*)/to-build
57 all --a2-bases
$(A2_BASE
) --dep-categories
$(DEP_CATEGORIES
) \
58 --category
$(A2_CATEGORY
) --bundles
$(subst $(A2_CATEGORY
)/,,$*)
60 $(BUILD_BASE
)/%/to-build
: $$(shell find
% -type f
-not
-path
'bin/*' -not
-path
'*/MANIFEST.MF' | sed
's/ /\\ /g')
66 %/META-INF
/MANIFEST.MF
: $(BUILD_BASE
)/%/META-INF
/MANIFEST.MF
67 ifneq ($(NO_MANIFEST_COPY
),true
)
73 @
rm -rf
$(foreach bundle
, $(BUNDLES
), $(bundle
)/META-INF
/MANIFEST.MF
);
75 osgi-all
: osgi jni-all
80 osgi-install
: jni-install
82 install --category
$(A2_CATEGORY
) --bundles
$(BUNDLES
) \
83 --target
$(A2_INSTALL_TARGET
) \
84 --os
$(TARGET_OS
) --target-native
$(A2_NATIVE_INSTALL_TARGET
)
86 osgi-uninstall
: jni-uninstall
88 uninstall --category
$(A2_CATEGORY
) --bundles
$(BUNDLES
) \
89 --target
$(A2_INSTALL_TARGET
) \
90 --os
$(TARGET_OS
) --target-native
$(A2_NATIVE_INSTALL_TARGET
)
93 $(foreach dir, $(JNIDIRS
), $(MAKE
) -C
$(dir) all;)
96 $(foreach dir, $(JNIDIRS
), $(MAKE
) -C
$(dir) clean;)
99 $(foreach dir, $(JNIDIRS
), $(MAKE
) -C
$(dir) install;)
102 $(foreach dir, $(JNIDIRS
), $(MAKE
) -C
$(dir) uninstall;)
105 javadoc
: $(BUILD_BASE
)/built
106 $(JAVADOC
) -noindex
-quiet
-Xmaxwarns
1 -d
$(BUILD_BASE
)/api
--source-path
$(subst $(space
),$(pathsep
),$(strip $(JAVADOC_SRCS
))) -subpackages
$(JAVADOC_PACKAGES
)
108 .PHONY
: osgi manifests javadoc osgi-all osgi-clean osgi-install osgi-uninstall jni-all jni-clean jni-install jni-uninstall