[ale] Bash wildcard

16 views
Skip to first unread message

Chris Fowler

unread,
Mar 26, 2012, 3:40:19 PM3/26/12
to Atlanta Linux Enthusiasts
This one stummped me. I wanted to create a tar of my makefiles so I
used find.

I wanted OURmakefile and OURmakefile.TEMPLATE. I could not use a
standard wildcard because I'd pull in svn files.

To get the wildcard for find I tried many differences of the following
with no luck.

[DEVEL PERL]$ ls OURmakefil[{e},{e.TEMPLATE}]
OURmakefile
[DEVEL PERL]$

[DEVEL PERL]$ ls -l OURmakefile*
-rw-rw-r-- 1 cfowler cfowler 3203 Mar 25 21:53 OURmakefile
-rw-rw-r-- 1 cfowler cfowler 63 Mar 21 13:16 OURmakefile.inc
-rw-rw-r-- 1 cfowler cfowler 563 Mar 26 15:29 OURmakefile.TEMPLATE
[DEVEL PERL]$


Ignore .inc

So what is the secret sauce?

Chris
_______________________________________________
Ale mailing list
A...@ale.org
http://mail.ale.org/mailman/listinfo/ale
See JOBS, ANNOUNCE and SCHOOLS lists at
http://mail.ale.org/mailman/listinfo

Chris Fowler

unread,
Mar 26, 2012, 4:06:16 PM3/26/12
to Atlanta Linux Enthusiasts
Before someone ask why I'm not using GNUmakefile I'll explain. For
years we've used GNUmakefile to build software while packages use
Makefile. The problem is that programmers are making Makefile so
complex it is hard for me to create a GNUmakefile that does not blow
something up. Makefile's now are calling make on their self to make
other targets. To fix this I've had to create those same targets in
GNUmakefile. I just got pissed over this weekend and said F'it. I did
a find on all our GNUmakefiles and renamed them to OURmakefile. Since
GNU make has no clue what that it I've solved the problem. In the main
tree I simply have one GNUmakefile symlinked to OURmakefile that fires
off the build process by working through the tree and executing 'make -f
OURmakefile <insert target here>'.

Why people can't keep things simple I do not know. I'm talking about:
all-recursive, clean-am, all-am, yada yada yada.

Oh yea, why is make not good enough for Java? Is it because the syntax
is so cryptic that Ant had to be created? I only say this from
experience. I tried to craft a whole build process in Perl for this
project and after going back to the GNU Make manual I've ditched it and
went back to make. :P

Dev Null

unread,
Mar 26, 2012, 5:08:11 PM3/26/12
to ALE Mailing List
How about
% ls OURmakefile.{,.TEMPLATE}
-- /dev/null

Chris Fowler

unread,
Mar 26, 2012, 5:26:27 PM3/26/12
to a...@ale.org
On 03/26/2012 05:08 PM, Dev Null wrote:
> ls OURmakefile.{,.TEMPLATE}

This:


ls OURmakefile{,.TEMPLATE}

Richard Bronosky

unread,
Mar 26, 2012, 6:35:14 PM3/26/12
to Atlanta Linux Enthusiasts

Square brackets are for matching char sets, not string sets.

Jim Lynch

unread,
Mar 26, 2012, 8:23:51 PM3/26/12
to Atlanta Linux Enthusiasts
I remove svn via: find . | grep -v svn


And have you looked at cmake?

Jim.

Ed Cashin

unread,
Mar 26, 2012, 10:45:17 PM3/26/12
to Atlanta Linux Enthusiasts
If there are so many version control artifacts that it affects search
times, you can use the find command's prune feature. It took me a
while to get used to using it, but it's worth it when it means
skipping a lot of work.

ecashin@Ed-Cashins-MacBook-Pro tmp$ find . -name 'OURmak*'
./.svn/OURmakefile
./.svn/OURmakefile.TEMPLATE
./foo/OURmakefile
./foo/OURmakefile.TEMPLATE
./OURmakefile
./OURmakefile.not_me
ecashin@Ed-Cashins-MacBook-Pro tmp$ cat om.sh
find . \( -type d -name .svn -prune -false \) \
-o \( -type d -name .git -prune -false \) \
-o \( -type d -name .hg -prune -false \) \
-o \( -type f -name 'OURmakefile' -print \) \
-o \( -type f -name 'OURmakefile.TEMPLATE' -print \)

ecashin@Ed-Cashins-MacBook-Pro tmp$ sh om.sh
./foo/OURmakefile
./foo/OURmakefile.TEMPLATE
./OURmakefile
ecashin@Ed-Cashins-MacBook-Pro tmp$

--
  Ed Cashin <eca...@noserose.net>
  http://noserose.net/e/
  http://www.coraid.com/

Reply all
Reply to author
Forward
0 new messages