Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.

Quickly create Makefile entries for all objects in a project using Sed

For this example, a project with over 200 Fortran source files is used (ncep BUFR library for GEMPAK):

ls *.f


adn30.f getbmiss.f istdesc.f nvnwin.f reads3.f ufbmns.f atrcpt.f getlens.f iupb.f nwords.f readsb.f ufbovr.f bfrini.f getntbe.f iupbs01.f nxtwin.f rewnbf.f ufbpos.f blocks.f gets1loc.f iupbs3.f openbf.f rjust.f ufbqcd.f bort2.f gettagpr.f iupm.f openbt.f rsvfvm.f ufbqcp.f bort.f gettbh.f iupvs01.f openmb.f rtrcpt.f ufbrep.f bvers.f getvalnb.f jstchr.f openmg.f seqsdx.f ufbrms.f cadn30.f getwin.f jstnum.f pad.f setblock.f ufbrp.f capit.f i4dy.f lcmgdf.f padmsg.f setbmiss.f ufbrw.f chekstab.f ibfms.f lmsg.f parstr.f sntbbe.f ufbseq.f chrtrna.f icbfms.f lstjpb.f parusr.f sntbde.f ufbsp.f chrtrn.f ichkstr.f makestab.f parutg.f status.f ufbstp.f cktaba.f icmpdx.f maxout.f pkb.f stbfdx.f ufbtab.f closbf.f icopysb.f mesgbc.f pkbs1.f stdmsg.f ufbtam.f

... 

You can quickly create standard formatting for Makefile objects with the command 

ls *.f | sed 's/.f/.o) \/' | sed 's/^/	$(ALIB)(/' 
 	$(ALIB)(adn30.o) 
$(ALIB)(atrcpt.o)
$(ALIB)(bfrini.o)
$(ALIB)(blocks.o)
$(ALIB)(bort2.o)
$(ALIB)(bort.o)
$(ALIB)(bvers.o)
$(ALIB)(cadn30.o)
$(ALIB)(capit.o)
$(ALIB)(chekstab.o)
$(ALIB)(chrtrna.o)
$(ALIB)(chrtrn.o)
$(ALIB)(cktaba.o)
$(ALIB)(closbf.o)
$(ALIB)(closmg.o)
$(ALIB)(cmpmsg.o)
$(ALIB)(cmsgini.o)

... 

Comments:

Post a Comment:
Comments are closed for this entry.
Unidata Developer's Blog
A weblog about software development by Unidata developers*
Unidata Developer's Blog
A weblog about software development by Unidata developers*

Welcome

FAQs

News@Unidata blog

Take a poll!

What if we had an ongoing user poll in here?

Browse By Topic
Browse by Topic
« May 2025
SunMonTueWedThuFriSat
    
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
       
Today