File: gar.mk
base-0 patch-1
Line 111Line 111
GARCH = $($(DESTIMG)_GARCH)
GARHOST = $($(DESTIMG)_GARHOST)

GARCH = $($(DESTIMG)_GARCH)
GARHOST = $($(DESTIMG)_GARHOST)


# Some architectures go by multiple names. GARCH should always be the string
# output by `arch'. ALTGARCH should be set to the other name. In cases where
# there is no altername name, set to GARCH
ALTGARCH = $(GARCH)
ALTGARCH := $(if $(filter $(GARCH),ppc),powerpc,$(ALTGARCH))

# GARTARGET may be exported from a package with an arbitrary value to indicate
# that dependencies of that package which recognize a "target" platform, such
# as GCC and GNU binutils, should target the specified platform. The default
# GARTARGET may be exported from a package with an arbitrary value to indicate
# that dependencies of that package which recognize a "target" platform, such
# as GCC and GNU binutils, should target the specified platform. The default
Line 179Line 185
# For rules that do nothing, display what dependencies they
# successfully completed
#DONADA = @echo "        [$@] complete. Finished rules: $+"
# For rules that do nothing, display what dependencies they
# successfully completed
#DONADA = @echo "        [$@] complete. Finished rules: $+"
DONADA = @touch $(COOKIEDIR)/$@; echo -e "        $(ANNOUNCECOLOR)[$(STAGECOLOR)$@$(ANNOUNCECOLOR)] complete for $(NAMECOLOR)$(GARNAME)$(ANNOUNCECOLOR).$(NORMALCOLOR)"
DONADA = @touch $(COOKIEDIR)/$@; echo -e "        $(ANNOUNCECOLOR)[$(STAGECOLOR)$@$(ANNOUNCECOLOR)] complete for $(NAMECOLOR)$(GARNAME)$(ANNOUNCECOLOR).$(NORMALCOLOR)"; which xtermset > /dev/null && xtermset -T "[$@] complete for $(GARNAME)" || true
# TODO: write a stub rule to print out the name of a rule when it
# *does* do something, and handle indentation intelligently.
# TODO: write a stub rule to print out the name of a rule when it
# *does* do something, and handle indentation intelligently.
Line 215Line 221
post-%:
        @true

post-%:
        @true


xtermset-%:
        -@which xtermset > /dev/null && xtermset -T "$(GARNAME): $*" || true

# Call any arbitrary rule recursively
deep-%: %
        @$(foreach IMG,$(IMGDEPS),for dep in $(filter-out $($(IMG)_NODEPEND),$($(IMG)_DEPENDS)); do $(MAKE) -C ../../$$dep DESTIMG=$(IMG) $@; done; )
# Call any arbitrary rule recursively
deep-%: %
        @$(foreach IMG,$(IMGDEPS),for dep in $(filter-out $($(IMG)_NODEPEND),$($(IMG)_DEPENDS)); do $(MAKE) -C ../../$$dep DESTIMG=$(IMG) $@; done; )
Line 259Line 268
#                                into $(DOWNLOADDIR) as necessary.
FETCH_TARGETS = $(addprefix $(DOWNLOADDIR)/,$(ALLFILES))

#                                into $(DOWNLOADDIR) as necessary.
FETCH_TARGETS = $(addprefix $(DOWNLOADDIR)/,$(ALLFILES))

fetch: announce pre-everything $(COOKIEDIR) $(DOWNLOADDIR) $(PARTIALDIR) $(addprefix dep-$(GARDIR)/,$(FETCHDEPS)) pre-fetch $(FETCH_TARGETS) post-fetch
fetch: announce xtermset-fetch pre-everything $(COOKIEDIR) $(DOWNLOADDIR) $(PARTIALDIR) $(addprefix dep-$(GARDIR)/,$(FETCHDEPS)) pre-fetch $(FETCH_TARGETS) post-fetch
        $(DONADA)

# returns true if fetch has completed successfully, false
        $(DONADA)

# returns true if fetch has completed successfully, false
Line 271Line 280
#                                 distfiles are valid.
CHECKSUM_TARGETS = $(addprefix checksum-,$(filter-out $(NOCHECKSUM),$(ALLFILES)))

#                                 distfiles are valid.
CHECKSUM_TARGETS = $(addprefix checksum-,$(filter-out $(NOCHECKSUM),$(ALLFILES)))

checksum: fetch $(COOKIEDIR) pre-checksum $(CHECKSUM_TARGETS) post-checksum
checksum: fetch xtermset-checksum $(COOKIEDIR) pre-checksum $(CHECKSUM_TARGETS) post-checksum
        $(DONADA)

# returns true if checksum has completed successfully, false
        $(DONADA)

# returns true if checksum has completed successfully, false
Line 301Line 310
EXTRACT_TARGETS = $(addprefix extract-,$(filter-out $(NOEXTRACT),$(DISTFILES)))
EXTRACT_SOURCEPKG = $(addprefix $(COOKIEDIR)/sourcepkg-,$(addsuffix /patch,$(SOURCEPKG)))

EXTRACT_TARGETS = $(addprefix extract-,$(filter-out $(NOEXTRACT),$(DISTFILES)))
EXTRACT_SOURCEPKG = $(addprefix $(COOKIEDIR)/sourcepkg-,$(addsuffix /patch,$(SOURCEPKG)))

extract: checksum $(EXTRACTDIR) $(COOKIEDIR) $(EXTRACT_SOURCEPKG) $(addprefix dep-$(GARDIR)/,$(EXTRACTDEPS)) pre-extract $(EXTRACT_TARGETS) post-extract
extract: checksum xtermset-extract $(EXTRACTDIR) $(COOKIEDIR) $(EXTRACT_SOURCEPKG) $(addprefix dep-$(GARDIR)/,$(EXTRACTDEPS)) pre-extract $(EXTRACT_TARGETS) post-extract
        $(DONADA)

# returns true if extract has completed successfully, false
        $(DONADA)

# returns true if extract has completed successfully, false
Line 319Line 328
# patch                        - Apply any provided patches to the source.
PATCH_TARGETS = $(addprefix patch-,$(PATCHFILES))

# patch                        - Apply any provided patches to the source.
PATCH_TARGETS = $(addprefix patch-,$(PATCHFILES))

patch: extract $(WORKSRC) pre-patch $(PATCH_TARGETS) post-patch
patch: extract xtermset-patch $(WORKSRC) pre-patch $(PATCH_TARGETS) post-patch
        $(DONADA)

# returns true if patch has completed successfully, false
        $(DONADA)

# returns true if patch has completed successfully, false
Line 346Line 355
CONFIGURE_TARGETS = $(addprefix configure-,$(CONFIGURE_SCRIPTS))
CONFIGURE_IMGDEPS = $(addprefix imgdep-,$(IMGDEPS))

CONFIGURE_TARGETS = $(addprefix configure-,$(CONFIGURE_SCRIPTS))
CONFIGURE_IMGDEPS = $(addprefix imgdep-,$(IMGDEPS))

configure: patch $(CONFIGURE_IMGDEPS) $(addprefix srcdep-$(GARDIR)/,$(SOURCEDEPS)) pre-configure $(CONFIGURE_TARGETS) post-configure
configure: patch xtermset-configure $(CONFIGURE_IMGDEPS) $(addprefix srcdep-$(GARDIR)/,$(SOURCEDEPS)) pre-configure $(CONFIGURE_TARGETS) post-configure
        $(DONADA)

# returns true if configure has completed successfully, false
        $(DONADA)

# returns true if configure has completed successfully, false
Line 357Line 366
# build                        - Actually compile the sources.
BUILD_TARGETS = $(addprefix build-,$(BUILD_SCRIPTS))

# build                        - Actually compile the sources.
BUILD_TARGETS = $(addprefix build-,$(BUILD_SCRIPTS))

build: configure pre-build $(BUILD_TARGETS) post-build
build: configure xtermset-build pre-build $(BUILD_TARGETS) post-build
        $(DONADA)

# returns true if build has completed successfully, false
        $(DONADA)

# returns true if build has completed successfully, false
Line 372Line 381
# install                - Install the results of a build.
INSTALL_TARGETS = $(addprefix install-,$(INSTALL_SCRIPTS)) $(addprefix install-license-,$(subst /, ,$(LICENSE)))

# install                - Install the results of a build.
INSTALL_TARGETS = $(addprefix install-,$(INSTALL_SCRIPTS)) $(addprefix install-license-,$(subst /, ,$(LICENSE)))

install: build $(addprefix dep-$(GARDIR)/,$(INSTALLDEPS)) $(INSTALL_DIRS) pre-install $(INSTALL_TARGETS) post-install $(DO_BUILD_CLEAN)
install: build xtermset-install $(addprefix dep-$(GARDIR)/,$(INSTALLDEPS)) $(INSTALL_DIRS) pre-install $(INSTALL_TARGETS) post-install $(DO_BUILD_CLEAN) $(if $(filter $(USE_STOW),yes),stow)
        $(DONADA)

# returns true if install has completed successfully, false
        $(DONADA)

# returns true if install has completed successfully, false
Line 390Line 399
        rm -rf $(COOKIEDIR)/*install*
        $(MAKE) install

        rm -rf $(COOKIEDIR)/*install*
        $(MAKE) install

# uninstall                - Remove the installation.
# TODO: actually write it!
uninstall: build
        @echo -e "$(ERRORCOLOR)$@ NOT IMPLEMENTED YET$(NORMALCOLOR)"
       
# uninstall                - Remove the installation if it was installed
#                                         with stow in mind.
uninstall:
        @$(if $(filter $(USE_STOW),yes),rm -rf $(DESTDIR)$(STOW_PREFIX)/$(GARNAME)-$(GARVERSION),echo -e "$(ERRORCOLOR)$@ only works if you installed with USE_STOW$(NORMALCOLOR)")
        $(DONADA)


# stow                        - merge stow-installed packages into the system.
stow: install xtermset-stow pre-stow stow-$(DISTNAME) post-stow
        $(DONADA)

unstow: unstow-$(DISTNAME)
        $(DONADA)
# package                - Create a package from an _installed_ port.
# TODO: actually write it!
# package                - Create a package from an _installed_ port.
# TODO: actually write it!