Makefile 2.11 KB
Newer Older
Maxime Perrotin's avatar
Maxime Perrotin committed
1
UNAME := $(shell uname)
2
ARCH := $(shell getconf LONG_BIT)
Maxime Perrotin's avatar
Maxime Perrotin committed
3 4

CC=gcc
Maxime Perrotin's avatar
Maxime Perrotin committed
5
exec = kazoo
Maxime Perrotin's avatar
Maxime Perrotin committed
6 7 8

all: build

9 10 11 12
templatesParser:
	$(MAKE) -C templates-parser -j

build:	| templatesParser
Maxime Perrotin's avatar
Maxime Perrotin committed
13
ifeq ($(UNAME), Linux)
14 15 16 17 18 19 20 21 22 23 24 25 26 27
	@echo "package TASTE.Parser_Version is" > src/taste-parser_version.ads.new
	@echo "   Parser_Release : constant String :=" >> src/taste-parser_version.ads.new
	@echo -n '      "' >> src/taste-parser_version.ads.new
	@git log --oneline | head -1 | cut -f1 -d' ' | tr -d '\012' >> src/taste-parser_version.ads.new
	@echo " ; Commit " | tr -d '\r\n' >> src/taste-parser_version.ads.new
	@git log | head -3 | tail -1 | cut -f1 -d"+" | tr -d '\r\n' >>  src/taste-parser_version.ads.new
	@echo "\";" >> src/taste-parser_version.ads.new
	@echo "   Ocarina_Version : constant String :=" >> src/taste-parser_version.ads.new
	@echo -n '      "' >> src/taste-parser_version.ads.new
	@ocarina --version | head -1 | tr -d '\012' >> src/taste-parser_version.ads.new
	@echo "\";" >> src/taste-parser_version.ads.new
	@echo -n "end TASTE.Parser_Version;" >> src/taste-parser_version.ads.new
	@if [ ! -f "src/taste-parser_version.ads" ] ; then                \
		mv src/taste-parser_version.ads.new src/taste-parser_version.ads;          \
Maxime Perrotin's avatar
Maxime Perrotin committed
28
	else                                            \
29 30
		MD1=`cat src/taste-parser_version.ads | md5sum` ;         \
		MD2=`cat src/taste-parser_version.ads.new | md5sum` ;     \
Maxime Perrotin's avatar
Maxime Perrotin committed
31
		if [ "$$MD1" != "$$MD2" ] ; then        \
32
			mv src/taste-parser_version.ads.new src/taste-parser_version.ads ;  \
Maxime Perrotin's avatar
Maxime Perrotin committed
33
		else                                    \
34
			rm src/taste-parser_version.ads.new ;             \
Maxime Perrotin's avatar
Maxime Perrotin committed
35 36 37
		fi ;                                    \
	fi
endif
38
	@#[ $(ARCH) == 64 ] && EXTRAFLAG="--target=x86_64-linux" ;
Maxime Perrotin's avatar
Maxime Perrotin committed
39
	OCARINA_PATH=`ocarina-config --prefix` \
Maxime Perrotin's avatar
Maxime Perrotin committed
40
            $(gnatpath)gprbuild -j0 -x -g $(exec) -p -P kazoo.gpr -XBUILD="debug" $$EXTRAFLAG
Maxime Perrotin's avatar
Maxime Perrotin committed
41 42 43

install:
	$(MAKE)
44 45
	mkdir -p `ocarina-config --prefix`/share/kazoo
	cp -a templates kazoo `ocarina-config --prefix`/share/kazoo
Maxime Perrotin's avatar
Maxime Perrotin committed
46

TASTE User's avatar
TASTE User committed
47
edit:
48
	OCARINA_PATH=`ocarina-config --prefix` gps
TASTE User's avatar
TASTE User committed
49

Maxime Perrotin's avatar
Maxime Perrotin committed
50 51 52
test:
	@$(MAKE) -C test

Maxime Perrotin's avatar
Maxime Perrotin committed
53
clean:
Maxime Perrotin's avatar
Maxime Perrotin committed
54
	rm -rf obj templates-parser $(exec) *~
Maxime Perrotin's avatar
Maxime Perrotin committed
55

56
.PHONY: install clean build edit test templatesParser