makefile编译没有规则的目标文件

时间:2013-08-02 18:13:14

标签: c makefile

我的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.

1 个答案:

答案 0 :(得分:1)

该错误可能意味着../include/seq_io.h不存在。您已将其列为依赖项,并且make坚持存在依赖项或者有某种方法可以自动创建它们。