autoresolving 'native' in build script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting autoresolving 'native' in build script
# 1  
Old 10-07-2008
autoresolving 'native' in build script

Greets. I have a build system that comprises of one parent script and about 150 children to build Gnome. I have a file that is sourced at the top of every script to gather variables needed for the build. In this variables file, CFLAGS are set.

What I would like to do is do a quick check somewhere for the use of -march=native. If found, I'd like to translate native into a static CPU opt to use for the package name ($ARCH). This is on Slackware BTW. Having a package named "foo-1.2.3-native-1.tgz" doesn't really tell you what $ARCH the package is for.....

Haven't thought of how I'm going to actually implement this yet so all build scripts have it available, but right now, I had a quick C file compilation in mind, supplying gcc with the verbose flag and then grep for the $ARCH? Eh..... I don't know. Sounds a little sloppy maybe. Especially if I had to do that for each child.

Anyone have any cool idea's for this? Thanks all.
# 2  
Old 10-12-2008
Not the prettiest of things but works....

Code:
echo "main(){}" > test.c
gcc -v -march=native -o test test.c 2>cpu
ARCH=$(cat cpu | grep -o "march=.*" | sed -e 's/ .*//' -e 's/march=//')
echo $ARCH

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using sqlite query to build script...

Okay, so this one is a bit above my knowledge level so I'm hoping for some pointers. Here's the scenario: I have a backup system on my network that makes single file images of the machines it's backing up and uses an sqlite database to keep track of everything. As is pretty typical with... (2 Replies)
Discussion started by: NyxPDX
2 Replies

2. Shell Programming and Scripting

Build.xml invocation by Build Script

Hi I have a build.xml file and I can run it on Windows via cmd. Now I want to write a script to invoke the same. Is there a way to do this? (1 Reply)
Discussion started by: ankur328
1 Replies

3. Shell Programming and Scripting

Script to check numerous ports / servers (Solaris native)

Hi I'd like to check that a bunch of firewall rules have been applied and, therefore, want to write a script that basically does the following: telnet serverA port1 telnet serverA port2 telnet serverB port1 telnet serverB port2 I would just compile the list in excel and run it as a... (2 Replies)
Discussion started by: jibberish
2 Replies

4. UNIX for Dummies Questions & Answers

Adding SDK Build on Kernel Source Build

Hi, So I downloaded this kernel source and was able to build it successfully. But I want to add this SDK source code inside, can anyone help me how to do this? Note that the SDK source can be built by itself. I added the SDK in the main Makefile: init-y := init/ #added SDK... (0 Replies)
Discussion started by: h0ujun
0 Replies

5. Shell Programming and Scripting

Script Not working as per its build

Can someone take a look into script, where and what is going wrong in this. (4 Replies)
Discussion started by: baraghun
4 Replies

6. Shell Programming and Scripting

How to build a command in a script

Hi All I am trying to build a script that will take data from a tab separated file and use that to split up a quicktime file. So far the code is as follows #!/bin/sh #test parsing of data #fix excel file output returns cat $1 | tr "\r" "\n" > $1.fix printf "\n" >> $1.fix mv $1.fix $1 ... (3 Replies)
Discussion started by: babajuma
3 Replies

7. Shell Programming and Scripting

Build script for all shells

Hi, I made a build script for the product I am working on. The script was made in the /bin/sh shell. My first line in the script (after the #! /bin/sh and following # lines ) were, if ; then /bin/sh fi; It works well with my sh shell. I run the script as sh build.sh Now I... (9 Replies)
Discussion started by: vino
9 Replies

8. Shell Programming and Scripting

I want to build a script

I have this script sed -e '$q' -e 's/I/D/g' <inputfile> outfile which replaces I by D... I have to run this script in 90 files which their filename starts with CD*. I want to call all these files and execute this command once. Or schedule it to be executed at 1600hrs every day. I want... (7 Replies)
Discussion started by: mewalter
7 Replies

9. Shell Programming and Scripting

Script Build

I have a 3 status option 1 , 4 , 6 1 - Active 4 - Temp.. 6 - Deactive I want to build a script which when it finds either of the status options (1,4,6), then returns the relevant string. txs :confused: (3 Replies)
Discussion started by: mewalter
3 Replies

10. Shell Programming and Scripting

I want to build a script

I have file which has "A" character in more than 1000 lines and I want replace this "A" with "f". There is also "A" which I don't want to replace at the last line. Currently, I use this script to replace them one by one :g/A/s//f/g Regards (2 Replies)
Discussion started by: mewalter
2 Replies
Login or Register to Ask a Question