debian swirl logo

Back to the packages list dragonegg

#!/usr/bin/make -f

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

LLVM_VERSION = 3.3
GCC_VERSION = 4.7
GCC_VERSION_NEXT = 4.8


deb_version		:= $(shell dpkg-parsechangelog | sed -ne "s/^Version: \(.*\)/\1/p")
upstream_version	:= $(shell echo $(deb_version) | sed -e "s/-[^-]*$$//")
major 			:= $(shell echo $(upstream_version) | sed -e "s/\([0-9]\+\.[0-9]\+\)[\.-].*/\1/g")

plugindir := $(shell gcc-$(GCC_VERSION) -print-file-name=plugin)
plugindir_NEXT := $(shell gcc-$(GCC_VERSION_NEXT) -print-file-name=plugin)

include /usr/share/cdbs/1/rules/debhelper.mk

stamps/build:
# link with llvm
		mkdir -p $(DEB_SRCDIR)/$(GCC_VERSION)
		cd $(DEB_SRCDIR)/$(GCC_VERSION); \
	GCC= gcc-$(GCC_VERSION) CC=gcc-$(GCC_VERSION) CXX=g++-$(GCC_VERSION) \
	DISABLE_VERSION_CHECK= 1 LDFLAGS="-L/usr/lib/llvm-$(LLVM_VERSION)/lib $(LDFLAGS)" \
		$(MAKE) \
		VERBOSE= 1 \
		LLVM_CONFIG= /usr/lib/llvm-$(LLVM_VERSION)/bin/llvm-config \
			-C ../; \
		mv ../dragonegg.so .

	make LLVM_CONFIG= /usr/lib/llvm-$(LLVM_VERSION)/bin/llvm-config clean

		mkdir -p $(DEB_SRCDIR)/$(GCC_VERSION_NEXT)
		cd $(DEB_SRCDIR)/$(GCC_VERSION_NEXT); \
	GCC= gcc-$(GCC_VERSION_NEXT) CC=gcc-$(GCC_VERSION_NEXT) CXX=g++-$(GCC_VERSION_NEXT) \
	DISABLE_VERSION_CHECK= 1 LDFLAGS="-L/usr/lib/llvm-$(LLVM_VERSION)/lib $(LDFLAGS)"  \
		$(MAKE) \
		VERBOSE= 1 \
		LLVM_CONFIG= /usr/lib/llvm-$(LLVM_VERSION)/bin/llvm-config \
			-C ..; \
		mv ../dragonegg.so .
		mkdir -p stamps
		touch $@


stamps/install:
		mkdir -p debian/dragonegg-$(GCC_VERSION)/$(plugindir)
		install -m755 $(DEB_SRCDIR)/$(GCC_VERSION)/dragonegg.so debian/dragonegg-$(GCC_VERSION)/$(plugindir)/
		mkdir -p debian/dragonegg-$(GCC_VERSION_NEXT)/$(plugindir_NEXT)
		install -m755 $(DEB_SRCDIR)/$(GCC_VERSION_NEXT)/dragonegg.so debian/dragonegg-$(GCC_VERSION_NEXT)/$(plugindir_NEXT)/
		mkdir -p stamps
		touch $@

stamps/install-llvm-gcc-$(GCC_VERSION):
		mkdir -p debian/llvm-gcc-$(GCC_VERSION)/usr/bin
		sed -e 's,@plugindir@,$(plugindir),' -e 's,@GCC_VERSION@,$(GCC_VERSION),' debian/gcc-wrap.in > debian/gcc-wrap
		for i in cpp g++ gcc gccbug gcov ; do \
			install -m755 debian/gcc-wrap debian/llvm-gcc-$(GCC_VERSION)/usr/bin/llvm-$$i ; \
		done
	# Do the same for c++ as gcc but without the version (not provided by
	# gcc-defaults)
		sed -e 's,@plugindir@,$(plugindir),' -e 's,@GCC_VERSION@,$(GCC_VERSION),' debian/c++-wrap.in > debian/c++-wrap

stamps/install-llvm-gcc-$(GCC_VERSION_NEXT):
		mkdir -p debian/llvm-gcc-$(GCC_VERSION_NEXT)/usr/bin
		sed -e 's,@plugindir@,$(plugindir_NEXT),' -e 's,@GCC_VERSION@,$(GCC_VERSION_NEXT),'  debian/gcc-wrap-next.in > debian/gcc-wrap
		for i in cpp g++ gcc gccbug gcov ; do \
			install -m755 debian/gcc-wrap debian/llvm-gcc-$(GCC_VERSION_NEXT)/usr/bin/llvm-$$i-$(GCC_VERSION_NEXT) ; \
		done
	# Do the same for c++ as gcc but without the version (not provided by
	# gcc-defaults)
		sed -e 's,@plugindir@,$(plugindir_NEXT),' -e 's,@GCC_VERSION@,$(GCC_VERSION_NEXT),' debian/c++-wrap.in > debian/c++-wrap

build/dragonegg-$(GCC_VERSION):: stamps/build
install/dragonegg-$(GCC_VERSION):: stamps/install

install/llvm-gcc-$(GCC_VERSION):: stamps/install-llvm-gcc-$(GCC_VERSION)

install/llvm-gcc-$(GCC_VERSION_NEXT):: stamps/install-llvm-gcc-$(GCC_VERSION_NEXT)

clean::
		rm -rf $(GCC_VERSION)  $(GCC_VERSION_NEXT)
		$(MAKE) clean VERBOSE=1 LLVM_CONFIG=/usr/lib/llvm-$(LLVM_VERSION)/bin/llvm-config
		rm -f debian/gcc-wrap
		rm -rf stamps

Builds:

dragonegg-4.7
gcc plugin that uses llvm for optimization and code generation
dragonegg-4.8
gcc plugin that uses llvm for optimization and code generation
dragonegg
gcc plugin that uses llvm for optimization and code generation
llvm-gcc-4.7
c front end for llvm c/c++ compiler
llvm-gcc-4.8
c front end for llvm c/c++ compiler