我是makefile的新手。我不确定为什么编译后没有出现可执行文件'main'。代码编译得很好,但编译器说:
-lm: linker input file unused because linking not done
-ltiff: linker input file unused because linking not done
下面是makefile代码:
INCLUDES = -I. -I../include -I/opt/local/include
CC = gcc
OBJS = image_io.o textfile_io.o main.o
CFLAGS = $(INCLUDES) -c -g
DESTDIR = ../bin
LDFLAGS = -L. -L../lib -L/opt/local/lib -lm
DEPS = file_io.h corr.h nmsimplex.h matrix.h /opt/local/include/tiffio.h \
/opt/local/include/tiff.h
image_io.o: image_io.c file_io.h /opt/local/include/tiffio.h \
/opt/local/include/tiff.h
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) -ltiff
textfile_io.o: textfile_io.c file_io.h
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
main.o: main.c file_io.h nmsimplex.h corr.h
$(CC) $(CFLAGS) -o $@ -fopenmp $< $(LDFLAGS)
main: $(OBJS)
$(CC) -o $(DESTDIR)/$@ -fopenmp $^ $(LDFLAGS)
.PHONY: clean
clean:
rm -f *.o *~
谢谢