Sponsored Content
Top Forums Shell Programming and Scripting bash command in makefile (cygwin) Post 302506404 by LMHmedchem on Sunday 20th of March 2011 03:19:44 PM
Old 03-20-2011
bash command in makefile (cygwin)

Hello,

In my make file (make 3.81), I use a combination of shell commands to automatically create the name of my build directory.
Code:
OS   := $(shell uname -s)
ARCH := $(shell uname -m)
KERN := $(shell uname -r | cut -d. -f 1,2)
BDIR := $(OS)_$(KERN).$(ARCH)

When I boot into different OSs, I build from the same shared directory. This code creates and assigns a different build dir based on whatever OS I am booted into. In Linux, the following command creates the dir if it doesn't exist.

Code:
# create build directory if it doesn't exist
archdir: ${BDIR}
${BDIR}:
    @mkdir -p ${BDIR}

This doesn't work under cygwin, and I'm not sure what the issue is. For now, I have to create the dir by hand when I boot into a windows OS.

Any ideas as to what the issue may be here?

I would also like to add the name of the linux distro, like fedora, debian, etc. Is there a shell command the will give that to me. If I do uname -s, I just get "Linux".

Thanks for the help,

LMHmedchem
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to use cygwin to run bash script

Hi, all, I try to run a quite simple bash script mytest.sh in cygwin, it's content is: #!/bin/bash echo "It is my first bash shell" there are three lines in the script. The second line is blank line. When I run it use command: bash c:/mytest.sh, ... (6 Replies)
Discussion started by: Jenny.palmy
6 Replies

2. UNIX for Dummies Questions & Answers

cygwin bash startup command weirdness (part 1)

I am running (I believe) the latest stable version of cygwin CYGWIN_NT-5.1 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin on a win xp sp2 laptop. Suppose, to make things simple for now (but I may do a part 2 posting...), that I am in a dos shell, and I want to create a bash shell and have it... (1 Reply)
Discussion started by: fabulous2
1 Replies

3. UNIX for Dummies Questions & Answers

Cygwin bash script and read command

Hello everyone, I am struggling a bit with a batch script that I need to run in cygwin. I work in winXP and I had to write some awk scripts to do some file manipulation, and now I would like to automate the process by just running a batch file so that my colleagues can use it easily. Now, the... (2 Replies)
Discussion started by: Teroc
2 Replies

4. Shell Programming and Scripting

Strange suppression of output with bash and cygwin

Hi, although I am not expert in bash, so please forgive me if this is silly, I think that this is strange: I have this command: find . -type f -print0 |xargs -0 grep -i -e 'some rexp' and it works fine. But when I create a bash script (on cygwin) to run this command, there is no output !!!... (3 Replies)
Discussion started by: Niki999
3 Replies

5. Shell Programming and Scripting

[Bash/Makefile] Concatenated string of filenames?

How would I go about storing a list of files in a sub-directory into a variable for argument passing? (2 Replies)
Discussion started by: ChazZeromus
2 Replies

6. Shell Programming and Scripting

redirect time command output to file (cygwin bash)

I have set up a bash script to run a long list of things that I need to time. I would like to redirect the output of time to a file. I have set it up like, echo "Runtimes for servlet 4, 100K structures" > test_times.txt echo "" >> test_times.txt echo "runs where N=10" >> test_times.txt echo... (7 Replies)
Discussion started by: LMHmedchem
7 Replies

7. Shell Programming and Scripting

Help with bash scripting in cygwin

Hi, I am trying to write a bash script, to open firefox and then open a local webpage in a tab. This is a shell of what I have #! /bin/sh alias firefox='/cygdrive/c/Program\ Files/Mozilla\ Firefox/firefox.exe' $URL='/cygdrive/d/Playback.html' firefox & sleep 1 for i in 1 2 3 4 5 #6 7 8 9... (1 Reply)
Discussion started by: jamie_123
1 Replies

8. UNIX for Dummies Questions & Answers

Bash on CygWin

I am using CygWin to run a bash file but I am getting weird results. #!/bin/bash mkdir CLEANDATA mv *FASTA CLEANDATA cd CLEANDATA ls echo "COMPLETE" And this is what I get $ ./Pipe.txt ./Pipe.txt: line 5: $'ls\r': command not found COMPLETE Moreover, the new folder is... (1 Reply)
Discussion started by: Xterra
1 Replies

9. Shell Programming and Scripting

Bash Script (tar + md) on Cygwin

Hi everybody, First, I'm sorry for my bad english! I have the following situation: I have a Windows 2012 R2 with Cygwin installed. The Windows Server is used as a backup Server with Dell AppAssure installed. At the moment, AppAssure saves Backup Targets to a repository on his D. The... (9 Replies)
Discussion started by: fibra3000
9 Replies

10. UNIX for Beginners Questions & Answers

Using BATCH to call a BASH script on CygWin

I am trying to use a batch file to automatically execute a bash script with no luck this far. The batch script looks like this: C:\Cygwin64\bin\bash test.sh I have also tried this: C:\Cygwin64\bin\bash "C:\Cygwin64\bin\test.sh" Needless to say that the windows box has Cygwin... (7 Replies)
Discussion started by: Xterra
7 Replies
AIMK(1PVM)							  PVM Version 3.4							AIMK(1PVM)

NAME
aimk - Portable make wrapper script SYNOPSIS
aimk [ -here ] [ make arguments ] DESCRIPTION
aimk is a wrapper program for make, used to portably select options to build PVM and PVM applications on various machines. Each port of PVM is assigned an architecture name. The name is used both during compilation (to conditionally switch in code) and at runtime (to select an executable or host). aimk uses the value of environment variable $PVM_ARCH if it is set, otherwise it calls $PVM_ROOT/pvmgetarch to determine the architecture name. pvmgetarch is a script that sniffs at various parts of the system to determine the correct architecture name. It is updated as new PVM ports are defined, and can be augmented locally. aimk determines the machine architecture and execs make, passing it the architecture and a configuration file along with arguments supplied to aimk. It runs make in a subdirectory to prevent executables from becoming intermixed and to permit overlapping compiles. A different makefile can be placed in each subdirectory or a single makefile, Makefile.aimk, can be shared between architectures. Per-architecture definitions from the $PVM_ROOT/conf directory are appended to the common makefile. aimk calls make is called in one of three ways, depend- ing on what makefiles are present: i. If $PVM_ARCH/Makefile or $PVM_ARCH/makefile exists, change directory to $PVM_ARCH and exec make there: (cd $PVM_ARCH ; make PVM_ARCH=$PVM_ARCH < aimk args >) ii. Else if Makefile.aimk exists, create $PVM_ARCH directory if it doesn't exist, then: (cd $PVM_ARCH ; make -f $PVM_ROOT/conf/$PVM_ARCH.def -f ../Makefile.aimk PVM_ARCH=$PVM_ARCH < aimk args >) iii. Else just exec make in current directory: make PVM_ARCH=$PVM_ARCH < aimk args > If aimk succeeds in calling make, the exit status is that of make, otherwise it is 1. FLAGS
-here Forces aimk to run make in the current directory, e.g. converts case i. to case iii. EXAMPLES
The following Makefile.aimk file builds and installs hello, creating the PVM binary directory if it doesn't exist. It can be run concur- rently on machines of different types, sharing the same source directory. LDIR = -L$(PVM_ROOT)/lib/$(PVM_ARCH) PVMLIB = -lpvm3 SDIR = .. BDIR = $(HOME)/pvm3/bin XDIR = $(BDIR)/$(PVM_ARCH) CFLAGS = -g -I$(PVM_ROOT)/include LIBS = $(LDIR) $(PVMLIB) $(ARCHLIB) $(XDIR): - mkdir $(BDIR) $(XDIR) hello: $(SDIR)/hello.c $(XDIR) $(CC) $(CFLAGS) -o $@ $(SDIR)/$@.c $(LIBS) mv $@ $(XDIR) ENVIRONMENT
$PVM_ROOT Root path of PVM installation. $PVM_ARCH PVM architecture name for machine. FILES
$PVM_ROOT/lib/aimk The aimk program $PVM_ROOT/conf/$PVM_ARCH.def Arch config file SEE ALSO
pvm_intro(1PVM) 02 May, 1994 AIMK(1PVM)
All times are GMT -4. The time now is 11:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy