summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2016-04-01 17:55:35 +0600
committerDaniil Baturin <daniil@baturin.org>2016-04-01 17:55:35 +0600
commitad7cbcd195198e78c2a6e67d5be3db6ffeb2a479 (patch)
tree8715a33ca2110c62ddd8689956a4cc9d386e748d
parent85bdc136388b07d039610df97362f07fe6529e2c (diff)
downloadhvinfo-ad7cbcd195198e78c2a6e67d5be3db6ffeb2a479.tar.gz
hvinfo-ad7cbcd195198e78c2a6e67d5be3db6ffeb2a479.zip
Fix conditional build.
-rw-r--r--.gitignore1
-rw-r--r--Makefile6
-rwxr-xr-xmkconfig.sh8
-rwxr-xr-xmkdefs.sh29
4 files changed, 35 insertions, 9 deletions
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 <daniil@baturin.org>
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+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