submakes的gcc输出目录

时间:2015-05-29 08:30:39

标签: gcc makefile

我有一个带有Sub make的makefile。我想将子制作的输出放在一个目录中。有人能解释我怎么做对吗?

-root |
      |-stub
      |-test
      |-source
      |-out
      |-makefile

我的所有子制作文件都应将其* .o文件放入其中。我收到错误,没有文件或目录./out/**.o如果我将../out添加到Objectfile。

这是我的submakefile

# makefile to generate UNIT-tests
# sub makefile for location stub


# define any directories containing header files other than /usr/include
# TODO 


# define any libraries to link into executable:
#	if I want to link in libraries (libx.so or libx.a) I use the -llibname 
#	option, something like (this will link in libmylib.so and libm.so:
LIBS = 

#  TODO define the C source files
SRCS = $(STUBS)

# define the C object files 
#
# This uses Suffix Replacement within a macro:
#	$(name:string1=string2)
#		  For each word in 'name' replace 'string1' with 'string2'

ODIR=../out

OBJ = $(SRCS:%.c=%.o)

# define the C compiler to use
CC = gcc
# define any compile-time flags

#compile without link
CFLAGS = -O0 -Wall -c -g -fmessage-length=0 -fprofile-arcs -ftest-coverage 				
#TODO Linkerflags
LFLAGS = --coverage 

# define the executable file,


all: $(TARGET) $(OBJ)	
	$(CC) $(OBJ) $(CFLAGS) -o $(TARGET) $(LFLAGS) $(OBJ) 
	
	@echo +++ build of stub finished +++
	
	
	
clean:
		$(RM) *.o *~ $(MAIN)

# DO NOT DELETE THIS LINE -- make depend needs it

0 个答案:

没有答案