From ad7cbcd195198e78c2a6e67d5be3db6ffeb2a479 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Fri, 1 Apr 2016 17:55:35 +0600 Subject: Fix conditional build. --- .gitignore | 1 + Makefile | 6 +++++- mkconfig.sh | 8 -------- mkdefs.sh | 29 +++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 9 deletions(-) create mode 100755 mkdefs.sh diff --git a/.gitignore b/.gitignore index 7975261..4e2186a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # Generated files src/config.ads +config.def # Build dir build/* diff --git a/Makefile b/Makefile index 783d4f3..413332d 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,10 @@ ifdef BUILD_TARGET BUILD_FLAGS = --target=$(BUILD_TARGET) endif -all: src/config.ads hvinfo +all: config.def src/config.ads hvinfo + +config.def: + ./mkdefs.sh src/config.ads: VERSION mkconfig.sh src/config.ads.in GNATPREP=$(GNATPREP) ./mkconfig.sh @@ -54,6 +57,7 @@ clean: rm -rf $(BUILD_DIR);\ fi rm -f $(CONFIG) + rm -f src/config.ads install: $(INSTALL) -d $(DESTDIR)/$(PREFIX)/$(BINDIR) diff --git a/mkconfig.sh b/mkconfig.sh index 54a91c2..fef0de0 100755 --- a/mkconfig.sh +++ b/mkconfig.sh @@ -36,14 +36,6 @@ case $OS in exit 1 esac -# Create the gnatprep defs file -# Determine the arch -rm -f $CONFIG -ARCH=$(uname -m) -if [ $(expr $ARCH : 'i*86') -o $(expr $ARCH : 'amd64') -o $(expr $ARCH : 'x86_64') ]; then - echo "X86 := True" >> $CONFIG -fi - $GNATPREP -D LINUX=$HVINFO_LINUX \ -D FREEBSD=$HVINFO_FREEBSD \ -D VERSION=\"$VERSION\" \ diff --git a/mkdefs.sh b/mkdefs.sh new file mode 100755 index 0000000..5f53512 --- /dev/null +++ b/mkdefs.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# Copyright (C) 2015 Daniil Baturin +# +# This file is part of hvinfo. +# +# hvinfo is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# hvinfo is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with hvinfo. If not, see . + +CONFIG=config.def + +# Create the gnatprep defs file +# Determine the arch +ARCH=$(uname -m) +X86=False +if [ ! $(expr $ARCH : 'i[356]86') -o $ARCH = 'amd64' -o $ARCH = 'x86_64' ]; then + X86=True +fi + +echo "X86 := $X86" > $CONFIG -- cgit v1.2.3