I suspect that
Code:
INSTDIR = $(prefix)/usr/bin/
is giving you a problem (the
$(prefix) appears undefined and the trailing
/ doesn't need to be there).
Here's a Makefile that does it all that may help
Code:
MAKEFILE = Makefile
# We use ${HOME}, you can use /usr, /usr/local, etc. Note ${BINDIR} below
BASDIR = ${HOME}
LDFLAGS = -lm
OWNER = ${LOGNAME}
GROUP = ${GRPNAME}
BINDIR = $(BASDIR)/bin
BMASK = 0755
MAINS = sample
OBJECTS = caldat.o julday.o sample.o
SOURCES = caldat.c julday.c sample.c
ALL: $(MAINS)
sample: sample.o caldat.o julday.o $(LIBRARY)
$(CC) $(CFLAGS) -s -o sample sample.o caldat.o julday.o $(LDFLAGS)
caldat.o:
julday.o:
sample.o:
install: $(MAINS)
cp $(MAINS) $(BINDIR)
cd $(BINDIR);\
chown $(OWNER) $(MAINS);\
chgrp $(GROUP) $(MAINS);\
chmod $(BMASK) $(MAINS)
remove:
cd $(BINDIR);\
rm -f $(MAINS)
clean:
rm -f $(OBJECTS)
clobber:
rm -f $(OBJECTS) $(MAINS)
The above follows the AT&T Bell Labs method.
Note that this consturct
Code:
$(CC) $(CFLAGS) -s -o
"strips" information from the executable (makes it smaller); a reasonable thing to do if you're not using profiling or debugging -- and don't do it if you are using either of those.
By the way, it's helpful if you enclose code samples in code blocks (easier to read).
Hope this helps some.