Makefile 1.69 KB
Newer Older
Maxime Perrotin's avatar
Maxime Perrotin committed
1
UNAME := $(shell uname)
Maxime Perrotin's avatar
Maxime Perrotin committed
2
CC=gcc
Maxime Perrotin's avatar
Maxime Perrotin committed
3 4
exec = buildsupport

Maxime Perrotin's avatar
Maxime Perrotin committed
5
all: build
Maxime Perrotin's avatar
Maxime Perrotin committed
6

Maxime Perrotin's avatar
Maxime Perrotin committed
7
build:
Maxime Perrotin's avatar
Maxime Perrotin committed
8
ifeq ($(UNAME), Linux)
9
	@echo "package Buildsupport_Version is" > ada/buildsupport_version.ads.new
Maxime Perrotin's avatar
Maxime Perrotin committed
10 11
	@echo "   Buildsupport_Release : constant String :=" >> ada/buildsupport_version.ads.new
	@echo -n "      \"" >> ada/buildsupport_version.ads.new
12
	@git log --oneline | head -1 | cut -f1 -d' ' | tr -d '\012' >> ada/buildsupport_version.ads.new
13 14
	@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
15
	@echo "\";" >> ada/buildsupport_version.ads.new
16
	@echo -n "end Buildsupport_Version;" >> ada/buildsupport_version.ads.new
Maxime Perrotin's avatar
Maxime Perrotin committed
17 18 19 20 21 22 23 24 25 26 27 28
	@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
29
	uname -a | grep x86_64 && EXTRAFLAG="--target=x86_64-linux" ; \
Maxime Perrotin's avatar
Maxime Perrotin committed
30
	ADA_PROJECT_PATH=`ocarina-config --prefix`/lib/gnat:$$ADA_PROJECT_PATH \
31
            $(gnatpath)gprbuild -x -g $(exec) -p -P buildsupport.gpr -XBUILD="debug" $$EXTRAFLAG
Maxime Perrotin's avatar
Maxime Perrotin committed
32 33

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

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

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