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)
Article Category
Article type
Developer Blog
Add new comment