0

I'm trying to run a Makefile to get a data-reduction pipeline working on my PC. My advisor built the pipeline, but he and I are currently 1000 miles from one another, so he is unable to help with this. Here is a snippet of my 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; 

And then there are a whole bunch of lines just like the one directly above for all of the other .c files, all with -lm at the end.

I'm getting the following errors when trying to run 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

Does this have to do with where I have these files located? Currently they reside in their own folder on my desktop. They are located in a subfolder of that directory called "programs."

My apologies if this is all very vague; I'm not very good with C.

Edit: Here is the full Makefile. It's long.

#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;
11
  • 4
    You miss -lm in the line building ccdacr target. Also somewhere there should be code for fourn function, which is not linked. Commented Feb 22, 2016 at 20:34
  • 1
    To fix the first warning, replace %d with either %lu (that's what the warning suggests) or %zu (which is what the latest C spec suggests). Commented Feb 22, 2016 at 20:34
  • This line cc ccdacr.c -o ccdacr in your output, doesn't show ccdacr getting linked against libm.so. Note the absence of -lm. You might want to check the line that starts with ccdacr:. I wish I have ESP so I can read your Makefile and pinpoint accurately which line number to fix. Commented Feb 22, 2016 at 20:54
  • 1
    You should post the section of the makefile that has the ccdacr: target . I suspect that there is actually not such a section and you have listed ccdacr as a target in the all section, but it's falling back to the default rule Commented Feb 22, 2016 at 20:54
  • 1
    Ah, that explains it... Commented Feb 22, 2016 at 22:28

2 Answers 2

1

You probably have to run make stccdacr instead, or you should change the rule

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

to

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

Otherwise a default rule will be invoked for make ccdacr which knows nothing about -lm.

Sign up to request clarification or add additional context in comments.

Comments

0

The problem is that you are trying to build a target, ccdacr, for which there is no rule in the makefile. Make knows how to build some things without being told, and it sees that you have a file ccdacr.c, so it uses its default rule for building things from C source files:

cc     ccdacr.c   -o ccdacr

This doesn't work because Make doesn't know that this source needs the math library. You can add a rule to your makefile:

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

This might work, it might not, depending on whether ccdacr needs any other sources. If it doesn't work, tell us the new error message and we'll go from there.

If it does work, I suspect you want the executable to go into ../bin/, so we can modify the rule:

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

This will work, but it breaks an important rule of makefiles: the target should be the exact name of the file being built(*). So this is better:

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

This is just the beginning. This makefile can be cleaned up and simplified a lot, but for now let's just get it working.

(*) This applies only to non-PHONY targets.

EDIT: The first warning is about line 349 in ccdacr.c:

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

You should change the %d to %zu (and if that doesn't work, try %lu) as @user3386109 suggested.

The error messages indicate that ccdacr needs code from another source, almost certainly fourn.c, so we change the rule:

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

Give this a try. If it works, we can still make it better. Are you familiar with the concept of object files? The idea is that instead of turning source files directly into an executable binary:

foo.c + bar.c => thing

the compiler builds a binary file for each source file, then links them together:

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

One advantage of this approach is that if many executables use one source file, that file need not be recompiled every time one of the executables must be rebuilt. This can speed the build process up quite a lot. If you're interested, we can start using this approach and putting the obejct files in bin/. And whether or not you want to use object files, once the new rule is working we can make it (and the old ones) much cleaner.

5 Comments

Okay, with the first addition I now get: cc ccdacr.c -o ccdacr -lm; 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/ccPRC0XH.o: In function `main': ccdacr.c:(.text+0x404a): undefined reference to `fourn' ccdacr.c:(.text+0x55a3): undefined reference to `fourn' ccdacr.c:(.text+0x5b43): undefined reference to `fourn' collect2: error: ld returned 1 exit status make: *** [ccdacr] Error 1
@uhurulol: No, there really isn't any better way in a comment, but that's good enough. See my edit.
Okay, back again. I've made the edits you suggest, but I still get the "unidentified reference" errors (the other warning does go away with the %zu change).
Update: If I make it just ccdacr instead of $(OUTDIR)/ccdacr it compiles fine, but then the program doesn't work when I go into GDL and try to type the command.
@uhurulol: 1) With $(OUTDIR)/ccdacr you get "unidentified reference" errors. This may be because you invoked Make as make ccdacr, in which case the output will still begin with cc ccdacr.c -o ccdacr; try make ../bin/ccdacr. 2) I'm not familiar with GDL. Does it give a coherent error message?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.