Makefile 1.76 KB
Newer Older
Maxime Perrotin's avatar
Maxime Perrotin committed
1
UNAME := $(shell uname)
2
ARCH := $(shell getconf LONG_BIT)
3
DEBIAN := $(shell uname -a | grep Debian)
Maxime Perrotin's avatar
Maxime Perrotin committed
4
CC=gcc
Maxime Perrotin's avatar
Maxime Perrotin committed
5 6
exec = buildsupport

Maxime Perrotin's avatar
Maxime Perrotin committed
7
all: build
Maxime Perrotin's avatar
Maxime Perrotin committed
8

Maxime Perrotin's avatar
Maxime Perrotin committed
9
build:
Maxime Perrotin's avatar
Maxime Perrotin committed
10
ifeq ($(UNAME), Linux)
11
	@echo "package Buildsupport_Version is" > ada/buildsupport_version.ads.new
Maxime Perrotin's avatar
Maxime Perrotin committed
12 13
	@echo "   Buildsupport_Release : constant String :=" >> ada/buildsupport_version.ads.new
	@echo -n "      \"" >> ada/buildsupport_version.ads.new
14
	@git log --oneline | head -1 | cut -f1 -d' ' | tr -d '\012' >> ada/buildsupport_version.ads.new
15 16
	@echo " ; Commit " | tr -d '\r\n' >> ada/buildsupport_version.ads.new
	@git log | head -3 | tail -1 | cut -f1 -d"+" | tr -d '\r\n' >>  ada/buildsupport_version.ads.new
Maxime Perrotin's avatar
Maxime Perrotin committed
17
	@echo "\";" >> ada/buildsupport_version.ads.new
18
	@echo -n "end Buildsupport_Version;" >> ada/buildsupport_version.ads.new
Maxime Perrotin's avatar
Maxime Perrotin committed
19 20 21 22 23 24 25 26 27 28 29 30
	@if [ ! -f "ada/buildsupport_version.ads" ] ; then                \
		mv ada/buildsupport_version.ads.new ada/buildsupport_version.ads;          \
	else                                            \
		MD1=`cat ada/buildsupport_version.ads | md5sum` ;         \
		MD2=`cat ada/buildsupport_version.ads.new | md5sum` ;     \
		if [ "$$MD1" != "$$MD2" ] ; then        \
			mv ada/buildsupport_version.ads.new ada/buildsupport_version.ads ;  \
		else                                    \
			rm ada/buildsupport_version.ads.new ;             \
		fi ;                                    \
	fi
endif
31 32
	@#[ "$(DEBIAN)" != "" ] && [ $(ARCH) == 64 ] && EXTRAFLAG="--target=x86_64-linux" ; \

33 34
	OCARINA_PATH=`ocarina-config --prefix` \
            $(gnatpath)gprbuild -x -g $(exec) -p -P buildsupport.gpr -XBUILD="debug" $$EXTRAFLAG -j4
Maxime Perrotin's avatar
Maxime Perrotin committed
35 36

install:
Maxime Perrotin's avatar
Maxime Perrotin committed
37
	$(MAKE)
Maxime Perrotin's avatar
Maxime Perrotin committed
38 39 40 41
	cp buildsupport `ocarina-config --prefix`/bin/
	cp misc/driveGnuPlotsStreams.pl `ocarina-config --prefix`/bin/

clean:
Maxime Perrotin's avatar
Maxime Perrotin committed
42
	rm -rf tmpBuild $(exec) *~
Maxime Perrotin's avatar
Maxime Perrotin committed
43

Maxime Perrotin's avatar
Maxime Perrotin committed
44
.PHONY: install clean build