Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: accommodate multiple simultaneous toolchain versions #4

Open
ilg-ul opened this issue Jul 2, 2011 · 4 comments
Open

Suggestion: accommodate multiple simultaneous toolchain versions #4

ilg-ul opened this issue Jul 2, 2011 · 4 comments

Comments

@ilg-ul
Copy link

ilg-ul commented Jul 2, 2011

In order to be able to maintain older versions of my projects, I sometimes need to keep older versions of the toolchains around.

The way I do this is to append the current date to the folder name of the toolchain.

For example, for the avr32 toolchain I used avr32-tools-20110702 instead of avr32-tools.

I also prefer to organise all my cross compiling toolchains in a folder named Cross.

Since my Cross compiling toolchains are not alone, my development environment also includes multiple Eclipse instances (located in a folder call Eclipses), so I keep everything in $HOME/Developer.

The patch I applied to your Makefile is:

PREFIX = $(HOME)/avr32-tools/

TODAY = date "+%Y%m%d"
PREFIX = $(HOME)/Developer/Cross/avr32-tools-$(TODAY)/

If you think such a more structured folder hierarchy is useful, I would be happy to see it used in your Makefile too (same for the ARM build).

Thank you,

Liviu

@ilg-ul
Copy link
Author

ilg-ul commented Jul 3, 2011

Regardless if you agree to change the Makefile PREFIX, could you change the syntax to do not overwrite previously defined environment variables?

PREFIX ?= $(HOME)/avr32-tools/

I did try such a definition, and together with the following lines before calling make, I think I obtained both simplicity in the Makefile and enough configurability of the build process.

Liviu

Numeric representation of today, like 20110704

TODAY=date "+%Y%m%d"

Keep different versions in different folders

TODAY_DIR=$HOME/Developer/Cross/avr32-tools-$TODAY

Remove the destination folder, in case it exists

if [ -d $TODAY_DIR ]
then
echo "Remove $TODAY_DIR"
rm -rf $TODAY_DIR
fi

Pass the custom destination folder to the make process

export PREFIX=$TODAY_DIR/

@jsnyder
Copy link
Owner

jsnyder commented Jul 5, 2011

This sounds good. I could also do this by git revision for those who have checked out from the repository:
GIT_REV = git rev-parse --verify HEAD --short
PREFIX = $(HOME)/avr32-tools-$(GIT_REV)/

This way the generated versions would be particular to the version the repo is at. The only major downside is that they're SHA-1 hashes so they don't really convey any sort of progression through time, but the file creation dates should provide that info.

It could also symlink avr32-tools to whatever the latest version is that's been installed with either scheme. I'll need to work out the logic for this a bit maybe. Tarball downloads don't have revision info except in the directory that gets created when unzipping/untarring...

@ilg-ul
Copy link
Author

ilg-ul commented Jul 5, 2011

Could you try the suggested question mark syntax?

PREFIX ?= $(HOME)/avr32-tools-$(GIT_REV)/

This would allow to export through the environment any custom folder.

Liviu

@jsnyder
Copy link
Owner

jsnyder commented Jul 27, 2011

I've now adjusted it to use a git revision, falling back to date if there is not .git directory or git is not installed. One can also specify prefix at the command line. It doesn't yet do any symlinking automatically, but I suppose I could add that to the message at the end as a suggestion for the user (a message is displayed on successful build showing the install location and providing a suggested export PATH=.. line)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants