c - How can I give the sourcefilepaths to gcc? -
how can give sourcepaths gcc
?
i have .c
files in source , test directory.
how can give gcc
path it? im compiling a
makefile` , message
"no such file or directory test.c"
my directory structure:
make-directory| | |--source | |--header | |--test | |--out |
as asked:
# makefile generate unit-tests # define directories containing header files other /usr/include # todo headers = :../cunit/headers \ cunit/sources/automated \ cunit/sources/basic \ cunit/sources/console \ cunit/sources/curses \ cunit/sources/framework \ cunit/sources/test \ cunit/sources/win \ cunit/sources/wxwidget \ stub \ ../source \ test sources = cunit/headers \ cunit/sources/automated \ cunit/sources/basic \ cunit/sources/console \ cunit/sources/curses \ cunit/sources/framework \ cunit/sources/test \ cunit/sources/win \ cunit/sources/wxwidget \ stub \ source \ test # define libraries link executable: # if want link in libraries (libx.so or libx.a) use -llibname # option, (this link in libmylib.so , libm.so: libs = # todo define c source files tst_srcs = min.c max.c srcs = cunit.c automated.c basic.c console.c cucurses.c cuerror.c cunit_intl.c \ mymem.c testdb.c testrun.c util.c wxwidget.c \ $(tst_srcs) # define c object files # # uses suffix replacement within macro: # $(name:string1=string2) # each word in 'name' replace 'string1' 'string2' #obj = $(srcs:%.c=%.o) obj = $(tst_srcs:%.c=%.o) #obj=$(join ($(sources)), $(notdir $(srcs:%.c=%.o))) # define c compiler use cc = gcc # define compile-time flags cflags = -o0 -g -wall -fmessage-length=0 -fprofile-arcs -ftest-coverage #todo linkerflags lflags = --coverage vpath=source # define executable file, target = cunit all: $(cc) -i $(headers) $(cflags) $(obj) -o $(target) $(lflags)
you can make use of vpath
or vpath
in makefile point directory containing source files.
see online gnu make manual here.
Comments
Post a Comment