Closed necrophcodr closed 10 years ago
Great, this is exactly the idea I had in mind (and didn't get around doing yet).
Now, there's a couple of things though. '[[' is bash syntax, but I'd really like the scripts to be sh compatible. It's just nicer this way. Also see:
https://wiki.ubuntu.com/DashAsBinSh
Using the COMPILER intermediate variable gives us a nice clean error message. However, I think just running $CC directly would work fine too. It will be very obvious if the compiler is missing, so there is no danger that the user will miss it.
In other words,
[ -z "$CC" ] && CC=cc
${CC} -o file file.c file2.c
What do you think? Simple and surely portable to almost any incarnation of sh.
How about that?
Yep, this looks great. Thank you!
These commits fixes issues where the user would have to edit the simple compilation scripts in order to build with their desired compiler. Now, certain issues may still be present, which is why this pull request should be checked and tested first. For the most part though, it should really just work by running the script, and using a different compiler can easily be specified through the use of the CC environment variable.
For instance, to compile using clang: