我的 makefile 正在编译 write_time.o,尽管我没有给它任何规则。但是,当我实际为它编写规则时,它不会编译。关于可能导致此问题的任何建议?下面是我的makefile:
INCLUDES = -I../include -I/opt/local/include
CC = gcc
OBJS = image_io.o xcorr.o textfile_io.o main.o array_processing.o \
fit2d.o poly.o mattran.o matsolve.o nelder_mead.o process.o \
open_seq_file.o write_time.o close_seq_file.o
DEBUGS = -g
CFLAGS = $(INCLUDES) -Wall -O2 $(DEBUGS)
DESTDIR = ../bin
LDFLAGS = -L. -L/opt/local/lib -ltiff -lm -L../lib -lmatrix ../include/seq_io.h
DEPS = ../include/file_io.h ../include/corr.h \
../include/matrix.h /opt/local/include/tiffio.h \
/opt/local/include/tiff.h ../include/seq_io.h
#../include/nmsimplex.h
all: $(DESTDIR)/main
image_io.o: image_io.c ../include/file_io.h /opt/local/include/tiffio.h \
/opt/local/include/tiff.h
$(CC) $(CFLAGS) -o $@ -c $<
xcorr.o: xcorr.c ../include/file_io.h
$(CC) $(CFLAGS) -o $@ -c $<
textfile_io.o: textfile_io.c ../include/file_io.h
$(CC) $(CFLAGS) -o $@ -c $<
array_processing.o: array_processing.c ../include/file_io.h
$(CC) $(CFLAGS) -o $@ -c $<
fit2d.o: fit2d.c ../include/matrix.h
$(CC) $(CFLAGS) -o $@ -c $<
poly.o: poly.c ../include/corr.h
$(CC) $(CFLAGS) -o $@ -c $<
nelder_mead.o: nelder_mead.c ../include/corr.h
$(CC) $(CFLAGS) -o $@ -c $<
# nmsimplex.o: nmsimplex.c ../include/nmsimplex.h
# $(CC) $(CFLAGS) -o $@ -c $<
process.o: process.c ../include/corr.h
$(CC) $(CFLAGS) -o $@ -c $<
mattran.o: mattran.c ../include/matrix.h
$(CC) $(CFLAGS) -o $@ -c $<
matsolve.o: matsolve.c ../include/matrix.h
$(CC) $(CFLAGS) -o $@ -c $<
open_seq_file.o: open_seq_file.c ../include/seq_io.h
$(CC) $(CFLAGS) -o $@ -c $<
close_seq_file.o: close_seq_file.c ../include/seq_io.h
$(CC) $(CFLAGS) -o $@ -c $<
main.o: main.c ../include/file_io.h ../include/nmsimplex.h ../include/corr.h ../include/seq_io.h
$(CC) $(CFLAGS) -o $@ -fopenmp -c $<
$(DESTDIR)/main: $(OBJS)
$(CC) -o $@ -fopenmp $^ $(LDFLAGS)
.PHONY: clean
clean:
rm -f *.o *~
这编译得很好。但是当我添加时:
write_time.o: write_time.c ../include/seq_io.h
$(CC) $(CFLAGS) -o $@ -c $<
我得到错误:
make: *** No rule to make target `../include/seq_io.h', needed by `write_time.o'. Stop.