Commit 6b7aa78e authored by Pawel Szostek's avatar Pawel Szostek

Makefile: add release generation

Conflicts:
	Makefile
parent 20c784df
misc misc
src/build_hash.py
examples examples
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011 Pawel Szostek (pawel.szostek@cern.ch) # Copyright (c) 2011 Pawel Szostek (pawel.szostek@cern.ch)
# #
# This source code is free software; you can redistribute it # This source code is free software; you can redistribute it
...@@ -17,24 +15,35 @@ ...@@ -17,24 +15,35 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
# #
SRC := configparser.py connection.py dep_solver.py fetch.py\ SRC_FILES := configparser.py connection.py dep_solver.py fetch.py\
flow.py flow_altera.py global_mod.py hdlmake_kernel.py\ flow.py flow_altera.py global_mod.py hdlmake_kernel.py\
__main__.py makefile_writer.py manifest_parser.py module.py msg.py path.py \ __main__.py makefile_writer.py manifest_parser.py module.py msg.py path.py \
srcfile.py vlog_parser.py new_dep_solver.py srcfile.py vlog_parser.py new_dep_solver.py
SRC_DIR := src
PREFIX := src SRC := $(foreach src, $(SRC_FILES), $(SRC_DIR)/$(src))
TAG = $(shell git describe --abbrev=0 --tags --always)#get the latest tag
ARCH := hdlmake RELEASE = hdlmake-$(TAG).tar.gz
EXEC := hdlmake
$(ARCH): $(foreach src, $(SRC), $(PREFIX)/$(src)) Makefile executable: $(EXEC)
$(EXEC): $(SRC)
bash embed_build_id.sh bash embed_build_id.sh
cd $(PREFIX) &&\ cd $(SRC_DIR) &&\
zip $(ARCH) $(SRC) &&\ zip $(EXEC) build_hash.py $(SRC_FILES) &&\
echo '#!/usr/bin/python' > $(ARCH) &&\ echo '#!/usr/bin/python' > $(EXEC) &&\
cat $(ARCH).zip >> $(ARCH) &&\ cat $(EXEC).zip >> $(EXEC) &&\
rm $(ARCH).zip &&\ rm $(EXEC).zip &&\
mv $(ARCH) .. chmod +x $(EXEC) &&\
chmod +x $(ARCH) mv $(EXEC) ..
release: $(RELEASE)
$(RELEASE): $(EXEC) $(SRC)
tar -zcvf $@ *
.PHONY: clean
clean: clean:
rm -f $(PREFIX)/*~ $(PREFIX)/*pyc rm -f $(SRC_DIR)/*~ $(PREFIX)/*pyc $(EXEC) hdlmake-*.tar.gz
\ No newline at end of file
...@@ -6,19 +6,7 @@ commit_string=$(echo $commit_line | awk '{print $2}') ...@@ -6,19 +6,7 @@ commit_string=$(echo $commit_line | awk '{print $2}')
date_line=$(git log | head -3 | tail -1) date_line=$(git log | head -3 | tail -1)
date_string=$(echo $date_line | awk '{print $6 $3 $4}') date_string=$(echo $date_line | awk '{print $6 $3 $4}')
embed_string=$(echo "$date_string:${commit_string:0:6}") embed_string='"'$(echo "$date_string:${commit_string:0:6}")'"'
if [ ! -f src/global_mod.py ]; then build_hash_path="src/build_hash.py"
echo "Can't find src/global_mod.py file to put the versionID inside" echo 'BUILD_ID = '"$embed_string" > $build_hash_path
exit 1
fi
global_mod_path="src/global_mod.py"
sed 's/^BUILD_ID =.*$/BUILD_ID = \"'$embed_string'"/' $global_mod_path > ${global_mod_path}_TMP
rm $global_mod_path
mv ${global_mod_path}_TMP $global_mod_path
if [ ! -f src/global_mod.py ]; then
echo "Shit! Something went wrong. Better check what happened to $global_mod_path"
exit 1
fi
\ No newline at end of file
No preview for this file type
...@@ -22,7 +22,4 @@ ...@@ -22,7 +22,4 @@
options = None options = None
top_module = None top_module = None
global_target = "''" global_target = "''"
#######
#this var is modified by the build makefile - DON'T TOUCH IT!
BUILD_ID = "2013Jan23:405c28"
###### ######
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
import global_mod import global_mod
try:
from build_hash import BUILD_ID
except:
BUILD_ID = "unrecognized"
import time import time
import os import os
import sys import sys
...@@ -52,7 +56,7 @@ def vpprint(msg): ...@@ -52,7 +56,7 @@ def vpprint(msg):
pp.pprint(msg) pp.pprint(msg)
def print_version(): def print_version():
rawprint("Hdlmake build "+global_mod.BUILD_ID) rawprint("Hdlmake build " + BUILD_ID)
def print_action_help(): def print_action_help():
rawprint("`Action' variable was not specified") rawprint("`Action' variable was not specified")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment