]>
git.argeo.org Git - cc0/argeo-build.git/blob - repackage.mk
1 ARGEO_BUILD_BASE
:= $(dir $(lastword
$(MAKEFILE_LIST
)))
2 include $(ARGEO_BUILD_BASE
)common.mk
4 # Common repackage routines to be included in Makefiles
6 # The following variables are found in the sdk.mk file which is generated by the configure script:
7 # SDK_SRC_BASE the base of the source code, typically the root of the cloned git repository
8 # SDK_BUILD_BASE the base of the output
9 # JAVA_HOME the base of the JDK used to build
10 A2_OUTPUT
= $(SDK_BUILD_BASE
)/a2
11 JVM ?
= $(JAVA_HOME
)/bin
/java
13 # The following variables should be declared in the including Makefile:
14 # CATEGORIES the space-separated list of categories to repackage
16 # The following variables have default values which can be overriden
17 # A2_BASE the space-separated directories where already built a2 categories can be found
18 A2_BASE ?
=/usr
/share
/a2
/usr
/local
/share
/a2
$(A2_OUTPUT
)
20 # Third-party libraries
21 LOGGER_JAR ?
= $(lastword
$(foreach base
, $(A2_BASE
), $(wildcard $(base
)/log
/syslogger
/org.argeo.tp
/org.argeo.tp.syslogger.
$(SYSLOGGER_BRANCH
).jar
)))
22 BNDLIB_JAR ?
= $(lastword
$(foreach base
, $(A2_BASE
), $(wildcard $(base
)/org.argeo.tp.build
/biz.aQute.bndlib.
$(BNDLIB_BRANCH
).jar
)))
25 ARGEO_REPACKAGE
= $(JVM
) -cp
$(LOGGER_JAR
):$(BNDLIB_JAR
) $(ARGEO_BUILD_BASE
)src
/org
/argeo
/build
/Repackage.java
26 TODOS_REPACKAGE
= $(foreach category
, $(CATEGORIES
),$(BUILD_BASE
)/$(category
)/to-repackage
)
27 BUILD_BASE
= $(SDK_BUILD_BASE
)/$(shell basename $(SDK_SRC_BASE
))
28 REPACKAGED_CATEGORIES
= $(foreach category
, $(CATEGORIES
),$(A2_OUTPUT
)/$(category
))
30 all: $(BUILD_BASE
)/repackaged
33 @
$(foreach category
, $(CATEGORIES
), mkdir
-p
$(A2_INSTALL_TARGET
)/$(category
); cp
$(A2_OUTPUT
)/$(category
)/*.jar
$(A2_INSTALL_TARGET
)/$(category
);)
34 @echo Installed
$(CATEGORIES
) to
$(A2_INSTALL_TARGET
)
37 @
$(foreach category
, $(CATEGORIES
), rm -rf
$(A2_INSTALL_TARGET
)/$(category
);)
38 @find
$(A2_INSTALL_TARGET
) -empty
-type d
-delete
39 @echo Uninstalled
$(CATEGORIES
) from
$(A2_INSTALL_TARGET
)
42 # We use .SECONDEXPANSION and CATEGORIES_TO_REPACKAGE instead of directly CATEGORIES
43 # so that we don't repackage a category if it hasn't changed
44 $(BUILD_BASE
)/repackaged
: CATEGORIES_TO_REPACKAGE
= $(subst $(abspath
$(BUILD_BASE
))/,, $(subst to-repackage
,, $?
))
45 $(BUILD_BASE
)/repackaged
: $(TODOS_REPACKAGE
)
46 $(ARGEO_REPACKAGE
) $(A2_OUTPUT
) $(CATEGORIES_TO_REPACKAGE
)
47 touch
$(BUILD_BASE
)/repackaged
49 $(BUILD_BASE
)/%/to-repackage
: $$(shell find
% -type f
)
55 $(foreach category
, $(CATEGORIES
), rm -rf
$(BUILD_BASE
)/$(category
))
56 rm -f
$(BUILD_BASE
)/repackaged