| File: gar.mk | |
|---|---|
| base-0 | patch-1 |
| Line 22 | Line 22 |
| # GARBUILD is the platform on which you're running GAR. If you want to # override it with a value other than what GCC thinks it's running on that's # ok, but the results will be very... VERY ...strange. | # GARBUILD is the platform on which you're running GAR. If you want to # override it with a value other than what GCC thinks it's running on that's # ok, but the results will be very... VERY ...strange. |
| GARBUILD ?= $(shell gcc -dumpmachine) | GARBUILD ?= $(shell $(build_CC) -dumpmachine) |
| # include the configuration file to override any of these variables # no variable expansions or targets are allowed in these files. include $(GARDIR)/gar.conf.mk -include $(addprefix $(GARDIR)/,$(GAR_EXTRA_CONF)) package-api.mk | # include the configuration file to override any of these variables # no variable expansions or targets are allowed in these files. include $(GARDIR)/gar.conf.mk -include $(addprefix $(GARDIR)/,$(GAR_EXTRA_CONF)) package-api.mk |
| # Give us color, if defined in gar.conf.mk ifeq ($(COLOR_GAR),yes) include $(GARDIR)/gar.color.mk endif | |
| ####### Default values for variables which remain unconfigured. ####### ##### Default image configuration ##### | ####### Default values for variables which remain unconfigured. ####### ##### Default image configuration ##### |
| Line 61 | Line 66 |
| $(DESTIMG)_GARCH ?= $(main_GARCH) $(DESTIMG)_GARHOST ?= $(main_GARHOST) | $(DESTIMG)_GARCH ?= $(main_GARCH) $(DESTIMG)_GARHOST ?= $(main_GARHOST) |
| # If not specified, then glibc $(DESTIMG)_LIBC ?= devel/glibc | |
| # Default image tools $(DESTIMG)_CC ?= $(main_CC) $(DESTIMG)_CXX ?= $(main_CXX) $(DESTIMG)_LD ?= $(main_LD) | # Default image tools $(DESTIMG)_CC ?= $(main_CC) $(DESTIMG)_CXX ?= $(main_CXX) $(DESTIMG)_LD ?= $(main_LD) |
| $(DESTIMG)_RANLIB ?= $(main_RANLIB) $(DESTIMG)_CPP ?= $(main_CPP) $(DESTIMG)_AS ?= $(main_AS) $(DESTIMG)_AR ?= $(main_AR) | |
| # Default image tool options $(DESTIMG)_CPPFLAGS ?= $(main_CPPFLAGS) | # Default image tool options $(DESTIMG)_CPPFLAGS ?= $(main_CPPFLAGS) |
| Line 109 | Line 121 |
| CC = $($(DESTIMG)_CC) CXX = $($(DESTIMG)_CXX) LD = $($(DESTIMG)_LD) | CC = $($(DESTIMG)_CC) CXX = $($(DESTIMG)_CXX) LD = $($(DESTIMG)_LD) |
| RANLIB = $($(DESTIMG)_RANLIB) CPP = $($(DESTIMG)_CPP) AS = $($(DESTIMG)_AS) AR = $($(DESTIMG)_AR) | |
| # Tool options -- These are append-mode assignments so that packages may # provide additional tool options. | # Tool options -- These are append-mode assignments so that packages may # provide additional tool options. |
| Line 134 | Line 150 |
| ALLFILES ?= $(DISTFILES) $(PATCHFILES) STAGINGDIR ?= $(build_DESTDIR)$(build_prefix)/staging | ALLFILES ?= $(DISTFILES) $(PATCHFILES) STAGINGDIR ?= $(build_DESTDIR)$(build_prefix)/staging |
| ####### Useful Macros ####### DIRSTODOTS = $(subst . /,./,$(patsubst %,/..,$(subst /, ,/$(1)))) ROOTFROMDEST = $(call DIRSTODOTS,$(DESTDIR)) | |
| # allow us to use programs we just built PATH := $(build_DESTDIR)$(build_libdir)/ccache:$(build_DESTDIR)$(build_bindir):$(build_DESTDIR)$(build_sbindir):$(PATH):$(build_DESTDIR)$(build_bindir):$(build_DESTDIR)$(build_sbindir) # this causes pain for all involved once glibc is built. | # allow us to use programs we just built PATH := $(build_DESTDIR)$(build_libdir)/ccache:$(build_DESTDIR)$(build_bindir):$(build_DESTDIR)$(build_sbindir):$(PATH):$(build_DESTDIR)$(build_bindir):$(build_DESTDIR)$(build_sbindir) # this causes pain for all involved once glibc is built. |
| Line 143 | Line 163 |
| # help nowadays: #LD_PRELOAD +=/lib/libc.so.6 | # help nowadays: #LD_PRELOAD +=/lib/libc.so.6 |
| # XXX: These macros should go in lib DIRSTODOTS = $(subst . /,./,$(patsubst %,/..,$(subst /, ,/$(1)))) ROOTFROMDEST = $(call DIRSTODOTS,$(DESTDIR)) | |
| # XXX: BUILD_CLEAN handling should go in lib ifdef BUILD_CLEAN DO_BUILD_CLEAN = buildclean | # XXX: BUILD_CLEAN handling should go in lib ifdef BUILD_CLEAN DO_BUILD_CLEAN = buildclean |
| Line 163 | Line 179 |
| # 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 " [$@] complete for $(GARNAME)." | DONADA = @touch $(COOKIEDIR)/$@; echo -e " $(ANNOUNCECOLOR)[$(STAGECOLOR)$@$(ANNOUNCECOLOR)] complete for $(NAMECOLOR)$(GARNAME)$(ANNOUNCECOLOR).$(NORMALCOLOR)" |
| # 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 182 | Line 198 |
| $(sort $(DOWNLOADDIR) $(PARTIALDIR) $(COOKIEDIR) $(WORKSRC) $(WORKDIR) $(EXTRACTDIR) $(FILEDIR) $(SCRATCHDIR) $(INSTALL_DIRS) $(GARCHIVEDIR) $(GARPKGDIR) $(STAGINGDIR)) $(COOKIEDIR)/%: @if test -d $@; then : ; else \ install -d $@; \ | $(sort $(DOWNLOADDIR) $(PARTIALDIR) $(COOKIEDIR) $(WORKSRC) $(WORKDIR) $(EXTRACTDIR) $(FILEDIR) $(SCRATCHDIR) $(INSTALL_DIRS) $(GARCHIVEDIR) $(GARPKGDIR) $(STAGINGDIR)) $(COOKIEDIR)/%: @if test -d $@; then : ; else \ install -d $@; \ |
| echo "install -d $@"; \ | echo -e "$(WORKCOLOR)making directory $(BOLD)$@$(NORMALCOLOR)"; \ |
| fi # These stubs are wildcarded, so that the port maintainer can | fi # These stubs are wildcarded, so that the port maintainer can |
| Line 225 | Line 241 |
| # what just happened when all the dependencies are finished. announce: | # what just happened when all the dependencies are finished. announce: |
| @echo "[===== NOW BUILDING: $(DISTNAME) =====]" | @echo -e "$(ANNOUNCECOLOR)[===== NOW BUILDING: $(NAMECOLOR)$(DISTNAME) $(ANNOUNCECOLOR)=====]$(NORMALCOLOR)" |
| # fetch-list - Show list of files that would be retrieved by fetch. # NOTE: DOES NOT RUN pre-everything! | # fetch-list - Show list of files that would be retrieved by fetch. # NOTE: DOES NOT RUN pre-everything! |
| Line 269 | Line 285 |
| makesum: fetch $(MAKESUM_TARGETS) @if test "x$(MAKESUM_TARGETS)" != "x "; then \ md5sum $(MAKESUM_TARGETS) > $(CHECKSUM_FILE) ; \ | makesum: fetch $(MAKESUM_TARGETS) @if test "x$(MAKESUM_TARGETS)" != "x "; then \ md5sum $(MAKESUM_TARGETS) > $(CHECKSUM_FILE) ; \ |
| echo "Checksums made for $(MAKESUM_TARGETS)" ; \ | echo -e "$(WORKCOLOR)Checksums made for $(NAMECOLOR)$(MAKESUM_TARGETS)$(NORMALCOLOR)" ; \ |
| cat $(CHECKSUM_FILE) ; \ fi | cat $(CHECKSUM_FILE) ; \ fi |
| Line 298 | Line 314 |
| # patches deal with the same file. # TODO: actually write it! checkpatch: extract | # patches deal with the same file. # TODO: actually write it! checkpatch: extract |
| @echo "$@ NOT IMPLEMENTED YET" | @echo -e "$(ERRORCOLOR)$@ NOT IMPLEMENTED YET$(NORMALCOLOR)" |
| # 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)) |
| Line 351 | Line 367 |
| # strip - Strip binaries strip: build pre-strip $(addprefix strip-,$(STRIP_SCRIPTS)) post-strip | # strip - Strip binaries strip: build pre-strip $(addprefix strip-,$(STRIP_SCRIPTS)) post-strip |
| @echo "$@ NOT IMPLEMENTED YET" | @echo -e "$(ERRORCOLOR)$@ NOT IMPLEMENTED YET$(NORMALCOLOR)" |
| # 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))) |
| Line 377 | Line 393 |
| # uninstall - Remove the installation. # TODO: actually write it! uninstall: build | # uninstall - Remove the installation. # TODO: actually write it! uninstall: build |
| @echo "$@ NOT IMPLEMENTED YET" | @echo -e "$(ERRORCOLOR)$@ NOT IMPLEMENTED YET$(NORMALCOLOR)" |
| # package - Create a package from an _installed_ port. # TODO: actually write it! package: build | # package - Create a package from an _installed_ port. # TODO: actually write it! package: build |
| @echo "$@ NOT IMPLEMENTED YET" | @echo -e "$(ERRORCOLOR)$@ NOT IMPLEMENTED YET$(NORMALCOLOR)" |
| # tarball - Make a tarball from an install of the package into a scratch dir tarball: tarball-$(DESTIMG) | # tarball - Make a tarball from an install of the package into a scratch dir tarball: tarball-$(DESTIMG) |
| Line 397 | Line 413 |
| # garpkg - Produce a garpkg and file it appropriately under $(GARPKGDIR) garpkg: $(GARPKGDIR) | # garpkg - Produce a garpkg and file it appropriately under $(GARPKGDIR) garpkg: $(GARPKGDIR) |
| $(MAKE) DESTIMG="$(DESTIMG)" $(DESTIMG)_prefix="/usr/local" tarball | $(MAKE) DESTIMG="$(DESTIMG)" $(DESTIMG)_prefix="/usr/local" install $(MAKE) DESTIMG="$(DESTIMG)" $(DESTIMG)_prefix="/usr/local" $(DESTIMG)_DESTDIR="$(CURDIR)/$(SCRATCHDIR)" reinstall find $(SCRATCHDIR) -depth -type d | while read i; do rmdir $$i > /dev/null 2>&1 || true; done tar czvf $(CURDIR)/$(WORKDIR)/$(DISTNAME)-$(DESTIMG)-install.tar.gz -C $(SCRATCHDIR)/usr/local . |
| install -m 644 -D $(CURDIR)/$(WORKDIR)/$(DISTNAME)-$(DESTIMG)-install.tar.gz $(GARPKGDIR)/$(DISTNAME).tar.gz ln -fs $(DISTNAME).tar.gz $(GARPKGDIR)/$(GARNAME).tar.gz rm -f $(GARPKGDIR)/$(GARNAME).tar.gz.sig | install -m 644 -D $(CURDIR)/$(WORKDIR)/$(DISTNAME)-$(DESTIMG)-install.tar.gz $(GARPKGDIR)/$(DISTNAME).tar.gz ln -fs $(DISTNAME).tar.gz $(GARPKGDIR)/$(GARNAME).tar.gz rm -f $(GARPKGDIR)/$(GARNAME).tar.gz.sig |
| Line 412 | Line 431 |
| # cookie, but that would be lame and unportable). clean: cookieclean @rm -rf $(DOWNLOADDIR) | # cookie, but that would be lame and unportable). clean: cookieclean @rm -rf $(DOWNLOADDIR) |
| @echo -e " $(ANNOUNCECOLOR)[$(STAGECOLOR)$@$(ANNOUNCECOLOR)] complete for $(NAMECOLOR)$(GARNAME)$(ANNOUNCECOLOR).$(NORMALCOLOR)" | |
| cookieclean: buildclean @rm -rf $(COOKIEROOTDIR) | cookieclean: buildclean @rm -rf $(COOKIEROOTDIR) |
| Line 425 | Line 445 |
| superclean: clean imgclean love: | superclean: clean imgclean love: |
| @echo "not war!" | @echo "$(REVERSE) not war! $(NORMALCOLOR)" |
| # these targets do not have actual corresponding files .PHONY: all fetch-list beaujolais fetch-p checksum-p extract-p patch-p configure-p build-p install-p love | # these targets do not have actual corresponding files .PHONY: all fetch-list beaujolais fetch-p checksum-p extract-p patch-p configure-p build-p install-p love |