Makefile 1.66 KB
Newer Older
Maxime Perrotin's avatar
Maxime Perrotin committed
1 2 3 4
GCCVERSION := $(shell gcc -v 2>&1 | grep ada | wc -l)
UNAME := $(shell uname)
VERSION=0.1

Maxime Perrotin's avatar
Maxime Perrotin committed
5
CC=gcc
Maxime Perrotin's avatar
Maxime Perrotin committed
6 7 8 9 10 11 12 13 14 15 16 17 18
exec = buildsupport

sources = $(wildcard ada/*.ad? c/*.c include/*.h)

all: checkVersion $(exec)

checkVersion:
#ifeq ($(UNAME),Linux)
#	@if [ $(GCCVERSION) -ne 1 ] ; then echo gcc must point to GNAT... check your PATH ; exit 1 ; fi
#endif

$(exec): $(sources)
ifeq ($(UNAME), Linux)
19 20
	@echo "package Buildsupport_Version is" > ada/buildsupport_version.ads.new
	@echo -n "   Buildsupport_Release : constant String := \"" >> ada/buildsupport_version.ads.new
21
	@git log --oneline | head -1 | cut -f1 -d' ' | tr -d '\012' >> ada/buildsupport_version.ads.new
Maxime Perrotin's avatar
Maxime Perrotin committed
22
	@echo "\";" >> ada/buildsupport_version.ads.new
23
	@echo -n "end Buildsupport_Version;" >> ada/buildsupport_version.ads.new
Maxime Perrotin's avatar
Maxime Perrotin committed
24 25 26 27 28 29 30 31 32 33 34 35
	@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
36
	ADA_PROJECT_PATH=`ocarina-config --prefix`/lib/gnat:$$ADA_PROJECT_PATH $(gnatpath)gprbuild -x -g $(exec) -p -P buildsupport.gpr -XBUILD="debug"
Maxime Perrotin's avatar
Maxime Perrotin committed
37 38

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

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

Maxime Perrotin's avatar
Maxime Perrotin committed
46
.PHONY: install clean