Makefile抛出未定义的引用错误

时间:2016-02-22 20:29:54

标签: c makefile

我试图运行Makefile以在我的PC上运行数据减少管道。我的顾问建造了管道,但他和我目前相距1000英里,所以他无法帮助解决这个问题。这是我的Makefile的片段:

#makefile for eph's programs
####site dependent parameters###
NR = ../nrecipes #location of numerical recipes routines (and header files)
NRU = ../nrecipes/utilities #location of N.R. utilities (and header files)
NRSUBS = ../nrecipes/nrsubs #N.R. subroutine library 
SUBS = ../subroutines
OUTDIR = ../bin
###end of site dependent parameters###

#fixed frame autocorrelation routine
acorr:
    gcc acorr.c -o $(OUTDIR)/acorr $(SUBS)/postape.c $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

testacr2:
    cc testacr2.c -o $(OUTDIR)/testacr2 $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#autocorrelation fitting program
acrfit:
    cc acrfit.c -o $(OUTDIR)/acrfit $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 

然后有很多行就像上面所有其他.c文件一样,最后都是-lm。

我在尝试运行make时遇到以下错误:

cc     ccdacr.c   -o ccdacr
ccdacr.c: In function ‘main’:
ccdacr.c:349:10: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
          printf("Read in FITS header. %d\n",sizeof(char));
          ^
/tmp/ccSt8UVm.o: In function `main':
ccdacr.c:(.text+0x2139): undefined reference to `sqrt'
ccdacr.c:(.text+0x30f4): undefined reference to `sqrt'
ccdacr.c:(.text+0x3125): undefined reference to `sqrt'
ccdacr.c:(.text+0x404a): undefined reference to `fourn'
ccdacr.c:(.text+0x55a3): undefined reference to `fourn'
ccdacr.c:(.text+0x5b43): undefined reference to `fourn'
/tmp/ccSt8UVm.o: In function `readnoisebias':
ccdacr.c:(.text+0x64eb): undefined reference to `sqrt'
/tmp/ccSt8UVm.o: In function `readnoisebias2':
ccdacr.c:(.text+0x690d): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status
make: *** [ccdacr] Error 1

这与我拥有这些文件的位置有关吗?目前,它们位于我桌面上的自己的文件夹中。它们位于该目录的子文件夹中,名为" programs。"

如果这一切都非常含糊,我道歉;我对C不太好。

编辑:这是完整的Makefile。很长。

#makefile for eph's programs
####site dependent parameters###
NR = ../nrecipes #location of numerical recipes routines (and header files)
NRU = ../nrecipes/utilities #location of N.R. utilities (and header files)
NRSUBS = ../nrecipes/nrsubs #N.R. subroutine library 
SUBS = ../subroutines
OUTDIR = ../bin
###end of site dependent parameters###

#fixed frame autocorrelation routine
acorr:
    gcc acorr.c -o $(OUTDIR)/acorr $(SUBS)/postape.c $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

testacr2:
    cc testacr2.c -o $(OUTDIR)/testacr2 $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#autocorrelation fitting program
acrfit:
    cc acrfit.c -o $(OUTDIR)/acrfit $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 
acrfit1:
    cc acrfit1.c -o $(OUTDIR)/acrfit1 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 
acrfit2:
    cc acrfit2.c -o $(OUTDIR)/acrfit2 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 
acrfit3:
    cc acrfit3.c -o $(OUTDIR)/acrfit3 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 
acrfit4:
    cc acrfit4.c -o $(OUTDIR)/acrfit4 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 
acrfit5:
    cc acrfit5.c -o $(OUTDIR)/acrfit5 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 
acrfit6:
    cc acrfit6.c -o $(OUTDIR)/acrfit6 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 
acrfit7:
    cc acrfit7.c -o $(OUTDIR)/acrfit7 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 

ftest7:
    cc ftest7.c -o $(OUTDIR)/ftest7 $(SUBS)/postape.c $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#fixed frame bispectrum routine
bispec:
    gcc bispec.c -o $(OUTDIR)/bispec $(SUBS)/postape.c $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c $(SUBS)/aalloc.c \
    $(SUBS)/fourn.c -lm;

#fixed frame bispectrum routine
tbispec:
    cc tbispec.c -o $(OUTDIR)/tbispec $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c $(SUBS)/putf.c $(SUBS)/aalloc.c \
    $(SUBS)/fourn.c -lm;

#channel saturation correction fixed frame bispectrum routine
bispenh:
    cc bispenh.c -o $(OUTDIR)/bispenh $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c $(SUBS)/putf.c $(SUBS)/aalloc.c \
    $(SUBS)/fourn.c -lm;

#speckle simulation frame blurring program
blur:
    cc blur.c -o $(OUTDIR)/blur -lm;

# ccd to mama conversion routine
ccd2mama:
    gcc ccd2mama.c -o $(OUTDIR)/ccd2mama -lm;

#ccd autocorrelation routine
stccdacr:
    gcc ccdacr.c -o $(OUTDIR)/ccdacr $(SUBS)/fourn.c -lm;

#Joe's ccd autocorrelation routine
jccdacr:
    gcc jccdacr.c -o $(OUTDIR)/jccdacr $(SUBS)/fourn.c -lm;

#emccd autocorrelation routine
emccdacr:
    gcc emccdacr.c -o $(OUTDIR)/emccdacr $(SUBS)/fourn.c -lm;

#ccd autocorrelation routine
ccdacrold:
    gcc ccdacrold.c -o $(OUTDIR)/ccdacrold $(SUBS)/fourn.c -lm;

#ccd integration routine
ccdint:
    gcc ccdint.c -o $(OUTDIR)/ccdint $(SUBS)/fourn.c -lm;

#ccd autocorrelation routine
ccdacr_octavi:
    gcc ccdacr_octavi.c -o $(OUTDIR)/ccdacr_octavi $(SUBS)/fourn.c -lm;

#ccd autocorrelation routine
ccdsaa:
    gcc ccdsaa.c -o $(OUTDIR)/ccdsaa $(SUBS)/fourn.c -lm;

#test ccd autocorrelation routine (for improvements, debugging)
tccdacr:
    gcc tccdacr.c -o $(OUTDIR)/tccdacr $(SUBS)/fourn.c -lm;

#ccd autocorrelation routine w/o correction for shutterless frame transfer
simccdacr:
    gcc simccdacr.c -o $(OUTDIR)/simccdacr $(SUBS)/fourn.c -lm;

#ccd bispectrum routine
ccdbsp:
    gcc ccdbsp.c -o $(OUTDIR)/ccdbsp $(SUBS)/fourn.c -lm;

#ccd bispectrum routine
ccdbspold:
    gcc ccdbspold.c -o $(OUTDIR)/ccdbspold $(SUBS)/fourn.c -lm;

#ccd image integration routine
ccdttrd:
    gcc ccdttrd.c -o $(OUTDIR)/ccdttrd $(SUBS)/fourn.c -lm;

#ccd power spectrum fitting routine
ccdpsfit:
    gcc ccdpsfit.c -o $(OUTDIR)/ccdpsfit $(SUBS)/fourn.c $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;


#ccd power spectrum fitting routine
gccdpsfit:
    gcc gccdpsfit.c -o $(OUTDIR)/gccdpsfit $(SUBS)/fourn.c $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#dispersion fitting program (variant of ccdpsfit)
dispfit:
    gcc dispfit.c -o $(OUTDIR)/dispfit $(SUBS)/fourn.c $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#test ccd power spectrum fitting routine
tccdpsfit:
    gcc tccdpsfit.c -o $(OUTDIR)/tccdpsfit $(SUBS)/fourn.c $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#ccd power spectrum fitting routine
ccdpsfitold:
    gcc ccdpsfitold.c -o $(OUTDIR)/ccdpsfitold $(SUBS)/fourn.c \
    $(SUBS)/nrutil.c $(SUBS)/amoeba.c -lm;

#ccd power spectrum fitting routine
dccdpsfit:
    gcc dccdpsfit.c -o $(OUTDIR)/dccdpsfit $(SUBS)/fourn.c $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#fgs power spectrum fitting routine
fgspsfit:
    gcc fgspsfit.c -o $(OUTDIR)/fgspsfit $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#fgs power spectrum fitting routine
fgspsfit2:
    gcc fgspsfit2.c -o $(OUTDIR)/fgspsfit2 $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#fgs power spectrum fitting routine
fgspsfit3:
    gcc fgspsfit3.c -o $(OUTDIR)/fgspsfit3 $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#ccd speckle photometry fitting routine
sphotom:
    gcc sphotom.c -o $(OUTDIR)/sphotom $(SUBS)/fourn.c $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#ccd modulus fitting routine
ccdmodfit:
    gcc ccdmodfit.c -o $(OUTDIR)/ccdmodfit $(SUBS)/fourn.c $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#channel saturation degradation program
chansat:
    cc chansat.c -o $(OUTDIR)/chansat $(SUBS)/postape.c \
    $(SUBS)/getframe0.c $(SUBS)/getframe1.c $(SUBS)/getat0.c \
    $(SUBS)/getat1.c $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#fixed frame centroiding routine
ctroid:
    gcc ctroid.c -o $(OUTDIR)/ctroid $(SUBS)/postape.c $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#2-dimensional cubic surface fitting routine
cubic:
    gcc cubic.c -o $(OUTDIR)/cubic $(SUBS)/amoeba.c $(SUBS)/nrutil.c -lm;

#fitting program for delta-m simulations
ddmfit:
    gcc ddmfit.c -o $(OUTDIR)/ddmfit $(SUBS)/amoeba.c $(SUBS)/nrutil.c -lm;
#fitting program for delta-m simulations
ddmfit2:
    gcc ddmfit2.c -o $(OUTDIR)/ddmfit2 $(SUBS)/amoeba.c $(SUBS)/nrutil.c -lm;


#flat fielded centroiding routine (test routine for Terry's platescale method)
ffctroid:
    gcc ffctroid.c -o $(OUTDIR)/ffctroid $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#2-dimensional Gaussian fitting routine
gfit2d:
    cc gfit2d.c -o $(OUTDIR)/gfit2d $(SUBS)/amoeba.c $(SUBS)/nrutil.c -lm;


#make integrated image from speckle file
mamattrd:
    gcc mamattrd.c -o $(OUTDIR)/mamattrd $(SUBS)/decode0.c \
    $(SUBS)/decode1.c -lm;

#make files for batch execution of osctroid, osacorr
mkalist:
    gcc mkalist.c -o $(OUTDIR)/mkalist;

#make files for batch execution of osctroid, osacorr, version can handle wosdva
mkalist2:
    gcc mkalist2.c -o $(OUTDIR)/mkalist2;

#make files for batch execution of point sources (SPIE-Hawaii sims)
mksimlist:
    gcc mksimlist.c -o $(OUTDIR)/mksimlist;

#make command file for simulation runs of binaries (delta-m sims)
mkbsimcmd:
    gcc mkbsimcmd.c -o $(OUTDIR)/mkbsimcmd -lm;

#make command file for simulation runs of binaries (delta-m sims)
mmkbsimcmd:
    gcc mmkbsimcmd.c -o $(OUTDIR)/mmkbsimcmd -lm;

#make .tab file for simulation runs of binaries (delta-m sims)
mksimflist:
    gcc mksimflist.c -o $(OUTDIR)/mksimflist -lm;

#make rough list of analyzed objects
mkrlist1:
    gcc mkrlist1.c -o $(OUTDIR)/mkrlist1 -lm;

#make .rlist file from a .rlist0 file of analyzed objects
mkrlist:
    gcc mkrlist.c -o $(OUTDIR)/mkrlist -lm;

#make .rlist0 file from a list of fits files (CCD data only)
mkrlist0:
    gcc mkrlist0.c -o $(OUTDIR)/mkrlist0 -lm;

#make final list of measures in CHARA 3rd Cat format
mkflist:
    gcc mkflist.c -o $(OUTDIR)/mkflist -lm;

#make final list of measures (SIM observations)
mkflist_sim:
    gcc mkflist_sim.c -o $(OUTDIR)/mkflist_sim -lm;

#make final list of measures in CHARA 3rd Cat format
mkflistf:
    gcc mkflistf.c -o $(OUTDIR)/mkflistf -lm;

#make final list of measures in CHARA 3rd Cat format (Brian's version)
mkflistwds:
    gcc mkflistwds.c -o $(OUTDIR)/mkflistwds -lm;

#make final list of photometry measures in CHARA 3rd Cat format
mkpflist:
    gcc mkpflist.c -o $(OUTDIR)/mkpflist -lm;

#make .cmd file for sphotom.c
mkspcmd:
    gcc mkspcmd.c -o $(OUTDIR)/mkspcmd -lm;

#make flist for seeing; includes failed measures
seeing:
    gcc seeing.c -o $(OUTDIR)/seeing -lm;

#make final list of measures in CHARA 3rd Cat format, small tel. version
lmkflist:
    gcc lmkflist.c -o $(OUTDIR)/lmkflist -lm;

#make final table of measures in table format
mkftab:
    gcc mkftab.c -o $(OUTDIR)/mkftab -lm;

#make final table of measures in table format (Photometry)
mkpftab:
    gcc mkpftab.c -o $(OUTDIR)/mkpftab -lm;

#make final table of measures in table format (Photometry)
mkpftab2:
    gcc mkpftab2.c -o $(OUTDIR)/mkpftab2 -lm;

#Tad's make final table of measures in table format w/ HIP data
mkftabdh:
    gcc mkftabdh.c -o $(OUTDIR)/mkftabdh -lm;

#make detectability table
dettab:
    gcc dettab.c -o $(OUTDIR)/dettab -lm;

#make shell script file for reducing acorrs to a final list of measures
mkmcmd:
    gcc mkmcmd.c -o $(OUTDIR)/mkmcmd;

#make modulus files for use with relphase
mkmod:
    cc mkmod.c -o $(OUTDIR)/mkmod $(SUBS)/fourn.c $(SUBS)/nrutil.c -lm

#oversampled frame autocorrelation routine
osacorr:
    gcc osacorr.c -o $(OUTDIR)/osacorr $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#oversampled frame autocorrelation routine for x5 mag (converts to low res)
osacorrx5:
    cc osacorrx5.c -o $(OUTDIR)/osacorrx5 $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#oversampled frame bispectrum routine
osbispec:
    gcc osbispec.c -o $(OUTDIR)/osbispec $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c $(SUBS)/aalloc.c \
    $(SUBS)/fourn.c -lm;

#oversampled frame centroiding routine
osctroid:
    gcc osctroid.c -o $(OUTDIR)/osctroid $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#oversampled frame centroiding routine, flat fielding version
ffosctroid:
    gcc ffosctroid.c -o $(OUTDIR)/ffosctroid $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#oversampled frame directed vector autocorrelation routine
osdva:
    gcc osdva.c -o $(OUTDIR)/osdva $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

osdva3:
    cc osdva3.c -o $(OUTDIR)/osdva3 $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

# merging routine for observing prelists
premerge:
    gcc premerge.c -o $(OUTDIR)/premerge

# merging routine for .flist files
mergeflist:
    gcc mergeflist.c -o $(OUTDIR)/mergeflist

# merging routine for .tab files (new [photometry] format)
mergepftab:
    gcc mergepftab.c -o $(OUTDIR)/mergepftab

# merging routine for .tab files (new [photometry] format)
mergepftab2:
    gcc mergepftab2.c -o $(OUTDIR)/mergepftab2

# merging routine for observing prelists
mergeflist_sim:
    gcc mergeflist_sim.c -o $(OUTDIR)/mergeflist_sim

# wiyn oversampled frame directed vector autocorrelation routine
wosdva:
    gcc wosdva.c -o $(OUTDIR)/wosdva $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

# wiyn oversampled frame directed vector autocorrelation routine 2
wosdva2:
    gcc wosdva2.c -o $(OUTDIR)/wosdva2 $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

ostest:
    cc test.c -o $(OUTDIR)/ostest $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#peak finding routine for autocorrelation functions
peakdet:
    cc peakdet.c -o $(OUTDIR)/peakdet -lm;
peakdet2:
    cc peakdet2.c -o $(OUTDIR)/peakdet2 -lm;

#power spectrum fitting program
psfit:
    cc psfit.c -o $(OUTDIR)/psfit $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 

#power spectrum fitting program (standard version as of june 1997)
ospsfit:
    gcc ospsfit.c -o $(OUTDIR)/ospsfit $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/gaussj.c $(SUBS)/nrutil.c -lm; 
#improved version
ospsfit2:
    cc ospsfit2.c -o $(OUTDIR)/ospsfit2 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/gaussj.c $(SUBS)/nrutil.c -lm; 
ospsfit2old:
    cc ospsfit2old.c -o $(OUTDIR)/ospsfit2old $(SUBS)/fourn.c \
    $(SUBS)/amoeba.c \
    $(SUBS)/gaussj.c $(SUBS)/nrutil.c -lm; 
#recursive method phase reconstructor (based on John Heanue's 'phasen.c')
recphase:
    cc recphase.c -lm -o $(OUTDIR)/recphase;

#relaxation (and/or recursion) method phase reconstructor
relphaseold:
    cc relphaseold.c -o $(OUTDIR)/relphaseold -lm;

relphase:
    gcc relphase.c -o $(OUTDIR)/relphase $(SUBS)/fourn.c -lm;

relphase2:
    cc relphase2.c -o $(OUTDIR)/relphase2 $(SUBS)/fourn.c -lm;

krelphase:
    cc krelphase.c -o $(OUTDIR)/krelphase $(SUBS)/fourn.c -lm;

#(masked) running window autocorrelation routine
rwacorr:
    cc rwacorr.c -o $(OUTDIR)/rwacorr $(SUBS)/postape.c \
    $(SUBS)/getdata0.c $(SUBS)/getdata1.c $(SUBS)/getat0.c \
    $(SUBS)/getat1.c $(SUBS)/decode0.c $(SUBS)/decode1.c -lm;

#(masked) running window bispectrum routine
rwbispec:
    cc rwbispec.c -o $(OUTDIR)/rwbispec $(SUBS)/postape.c \
    $(SUBS)/getdata0.c $(SUBS)/getdata1.c $(SUBS)/getat0.c \
    $(SUBS)/getat1.c $(SUBS)/decode0.c $(SUBS)/decode1.c \
    $(SUBS)/aalloc.c $(SUBS)/putf.c $(SUBS)/fourn.c -lm;

#fixed frame centroid-and-add
shiftnadd:
    gcc shiftnadd.c -o $(OUTDIR)/shiftnadd $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#speckle data simulation routine
spsim:
    cc spsim.c -o $(OUTDIR)/spsim $(SUBS)/fourn.c -lm;
tspsim:
    gcc tspsim.c -o $(OUTDIR)/tspsim $(SUBS)/fourn.c -lm;
spsimbig:
    cc spsimbig.c -o $(OUTDIR)/spsimbig $(SUBS)/fourn.c -lm;

#ccd speckle data simulation routine
ccdspsim:
    gcc ccdspsim.c -o $(OUTDIR)/ccdspsim $(SUBS)/fourn.c -lm;

#ccd speckle data simulation routine
isospsim:
    gcc isospsim.c -o $(OUTDIR)/isospsim $(SUBS)/fourn.c -lm;

#ccd speckle data simulation routine w/ microchannel saturation
mccdspsim:
    gcc mccdspsim.c -o $(OUTDIR)/mccdspsim $(SUBS)/fourn.c -lm;

bccdspsim:
    cc bccdspsim.c -o $(OUTDIR)/bccdspsim $(SUBS)/fourn.c -lm;
#Frequency space signal-to-noise estimator
s2n:
    gcc s2n.c -o $(OUTDIR)/s2n -lm;

#speckle frame integration routine
spint:
    cc spint.c -o $(OUTDIR)/spint $(SUBS)/postape.c $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

# PMIS header reader
rdpmishdr:
    cc rdpmishdr.c -o $(OUTDIR)/rdpmishdr;

# integrate fake speckle data frames
ztrans:
    cc ztrans.c -o $(OUTDIR)/ztrans -lm;


# "To do" List....


cpmamatp:
    cc cpmamatp.c -o $(OUTDIR)/cpmamatp $(SUBS);

cshift:
    cc cshift.c -o $(ZLIB)/cshift.X -lzproc -lm;

gaufit:
    cc gaufit.c -o $(ZLIB)/gaufit.X -I$(NR) -I$(NRU) -I$(IZ) $(NRSUBS) \
    -lzproc -lm;

gaulfit:
    cc gaulfit.c -o $(ZLIB)/gaulfit.X -I$(NR) -I$(NRU) -I$(IZ) $(NRSUBS) \
    -lzproc -lm;

gauss:
    cc gauss.c -o $(ZLIB)/tgauss.X -I$(IZ) $(SUBS) -lzprocx -lm;

radial:
    cc radial.c -o $(ZLIB)/radial.X -I$(IZ) -lzproc -lm;

recombine:
    cc recombine.c -o $(ZLIB)/recombine.X -I$(IZ) $(SUBS) -lzdump -lzproc;

shrink:
    cc shrink.c -o $(OUTDIR)/shrink $(SUBS) $(NRSUBS) -lzdump -lm;

thist:
    cc thist.c -o $(OUTDIR)/thist $(SUBS) $(NRSUBS) -lzdump -lm;


#FORTRAN ROUTINES--------------------------------------------------------

#extraction program for Washington Double Star Catalog
extractwds:
    f77 extractwds.f -o $(OUTDIR)/extractwds;

#extraction program for Hipparcos Catalog
xhip:
    gfortran xhip.f -o $(OUTDIR)/xhip;

#extraction program for Hipparcos Catalog, suspected objects
xhips:
    f77 xhips.f -o $(OUTDIR)/xhips;

#extraction program for Hipparcos Catalog
xhip3:
    gfortran xhip3.f -o $(OUTDIR)/xhip3;

#extraction program for Hipparcos Catalog
xhip_ctio:
    gfortran xhip_ctio.f -o $(OUTDIR)/xhip_ctio;

#extraction program for Hipparcos Catalog
nstars:
    gfortran nstars.f -o $(OUTDIR)/nstars;

#extraction program for SIM candidate grid stars from the USNO list
xsim:
    gfortran xsim.f -o $(OUTDIR)/xsim;
#extraction program for WDS
xwds:
    gfortran xwds.f -o $(OUTDIR)/xwds;
#extraction program for WDS
xwds2:
    gfortran xwds2.f -o $(OUTDIR)/xwds2;

#extraction program for WDS
xusno:
    gfortrans xusno.f -o $(OUTDIR)/xusno;

#old extraction program for Yale Bright Star Catalog (version 5) single object
extractbsc:
    f77 extractbsc.f -o $(OUTDIR)/extractbsc;
#old extraction program for Yale Bright Star Catalog (version 5) final obslist
extractbsc2:
    f77 extractbsc2.f -o $(OUTDIR)/extractbsc2;
#old extraction program for Yale Bright Star Catalog (version 5) wiyn format
extractbsc3:
    f77 extractbsc3.f -o $(OUTDIR)/extractbsc3;
#new (11/98) extraction program for Yale Bright Star Catalog (version 5)
xbsc:
    gfortran xbsc.f -o $(OUTDIR)/xbsc;

#program to fit slit mask files with Terry's optmask routine
optmask3:
    f77 optmask3.f -o $(OUTDIR)/optmask3;

#program to fit slit mask files with Terry's optmask routine
# use this version for aliased lines
optmask3a:
    f77 optmask3a.f -o $(OUTDIR)/optmask3a;

#program to fit slit mask files with Terry's optmask routine
# use this version for CASLEO data
optmask3c:
    f77 optmask3c.f -o $(OUTDIR)/optmask3c;

#program to fit star trail files with Terry's routine
trail:
    gfortran trail.f -o $(OUTDIR)/trail;

#program to convert Julian Date to Bessian Year
jd2by:
    gcc jd2by.c -lm -o $(OUTDIR)/jd2by;

# "official" version of Meridith's orbitfit2 program
orbitfit:
    gcc orbitfit.c -o $(OUTDIR)/orbitfit $(SUBS)/amoeba.c  \
        $(SUBS)/nrutil.c -lm;
# Indiv. errors version of Meridith's orbitfit2 program
orbitfiterr:
    gcc orbitfiterr.c -o $(OUTDIR)/orbitfiterr $(SUBS)/amoeba.c  \
        $(SUBS)/nrutil.c -lm;

2 个答案:

答案 0 :(得分:1)

您可能需要改为运行make stccdacr,或者您应该更改规则

stccdacr:
    gcc ccdacr.c -o $(OUTDIR)/ccdacr $(SUBS)/fourn.c -lm;

ccdacr:
    gcc ccdacr.c -o $(OUTDIR)/ccdacr $(SUBS)/fourn.c -lm;

否则将为make ccdacr调用默认规则,该-lmnot_if do ::File.exists?('/path/to/some_empty_file') end一无所知。

答案 1 :(得分:0)

问题是您正在尝试构建目标ccdacr,而makefile中没有规则。 Make知道如何在不被告知的情况下构建一些东西,并且它看到你有一个文件ccdacr.c,所以它使用它的默认规则从C源文件构建东西:

cc     ccdacr.c   -o ccdacr

这不起作用,因为Make并不知道此来源需要数学库。您可以在makefile中添加规则:

ccdacr:
    cc ccdacr.c -o ccdacr -lm;

这可能有用,可能不会,取决于ccdacr是否需要任何其他来源。如果它不起作用,请告诉我们新的错误消息,我们将从那里开始。

如果 工作,我怀疑您希望可执行文件进入../bin/,因此我们可以修改规则:

ccdacr:
    cc ccdacr.c -o $(OUTDIR)/ccdacr -lm;

这样可行,但它打破了makefile的一个重要规则:目标应该是正在构建的文件的确切名称(*)。所以这更好:

$(OUTDIR)/ccdacr:
    cc ccdacr.c -o $(OUTDIR)/ccdacr -lm;

这只是一个开始。这个makefile可以清理和简化很多,但是现在让我们开始工作。

(*)这仅适用于非PHONY目标。

编辑:第一个警告是关于ccdacr.c中的第349行:

printf("Read in FITS header. %d\n",sizeof(char));

您应该将%d更改为%zu(如果这不起作用,请尝试%lu),如@ user3386109所示。

错误消息表明ccdacr需要来自其他来源的代码,几乎肯定是fourn.c,因此我们更改规则:

$(OUTDIR)/ccdacr:
    cc ccdacr.c $(SUBS)/fourn.c -o $(OUTDIR)/ccdacr -lm;

试一试。如果它有效,我们仍然可以做得更好。您熟悉目标文件的概念吗?我们的想法是,不要将源文件直接转换为可执行的二进制文件:

foo.c + bar.c => thing

编译器为每个源文件构建一个二进制文件,然后将它们链接在一起:

foo.c => foo.o
bar.c => bar.o
foo.o + bar.o => thing

这种方法的一个优点是,如果许多可执行文件使用一个源文件,则每次必须重建其中一个可执行文件时,不需要重新编译该文件。这可以大大加快构建过程。如果您有兴趣,我们可以开始使用此方法并将obejct文件放在bin/中。无论你是否想要使用目标文件,一旦新规则正常工作,我们可以使它(和旧规则)更清洁。