in Education by
Since the *.o, *.h file and *.c files are stored in different directories, do I need add prefix $(ODIR) or $(IDIR) everytime I write a *.o or *.h file? Is there a graceful way to do it? Perhaps some way like $(IDIR)/{a.h, b.h, c.h}? This is the sample of makefile: GCC = gcc CFLAGS = CFLAGS_DEBUG_STRICT = -Wall pedantic -ansi -ggdb -DDEBUG CFLAGS_DEBUG = -Wall -ggdb -DDEBUG LFLAGS = SDIR = ../src ODIR = obj IDIR = ../include INCLUDES = LIDR = ../lib/ LIBS = all : keyword_match_test keyword_match_test : $(ODIR)/keyword_match_test.o $(ODIR)/keyword_match.o $(GCC) $(CFLAGS_DEBUG) -o $@ $+ $(ODIR)/keyword_match_test.o : keyword_match_test.c $(IDIR)/keyword_match.h $(GCC) $(CFLAGS_DEBUG) -c -o $@ $< -I$(IDIR) $(ODIR)/keyword_match.o : $(SDIR)/keyword_match.c $(IDIR)/keyword_match.h $(IDIR)/global.h $(GCC) $(CFLAGS_DEBUG) -c -o $@ $< -I/usr/include/mysql -I$(IDIR) JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
In addition to @macs suggestion with explicitely placed object files, GNU make's vpath directive can help you: vpath %.h $(IDIR) vpath %.o $(ODIR) $(ODIR)/keyword_match_test.o : keyword_match_test.c keyword_match.h

Related questions

0 votes
    If I use socket.makefile and then close the file object as well as the underlying socket, then subsequent ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    I'm following @zdim's recursive solution in this question fastest way to sum the file sizes by owner in ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I have a JSON File with database environment configuration called env-config.json like this: { "LATEST":{ ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    Which of the following action variable is used to include a file in JSP? (a) jsp:setProperty (b) jsp:getProperty ... JSP & API of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
0 votes
    Which of the following action variable is used to include a file in JSP? (a) jsp:setProperty (b) ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    the directory /Library/Frameworks/Python.framework/ contains the following four elements: Headers Python Resources ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 18, 2022 in Education by JackTerrance
0 votes
    I've following two path path1- test/hello/hello.php path2- test/hello1/hello1.php //notice the one ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 19, 2022 in Education by JackTerrance
0 votes
    I've following two path path1- test/hello/hello.php path2- test/hello1/hello1.php //notice the one ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I've written a Dockerfile with the intent of hosting a game server in a Docker container, but the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    I write a tool using Split and Join Files Tool. My code is: foreach (String inputfiles in filename) ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    I write a tool using Split and Join Files Tool. My code is: foreach (String inputfiles in filename) ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    If the code is stored in the external file, which of the following function is used to call them to a ... Started of R Programming Select the correct answer from above options...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    If commands are stored in an external file, say commands.R in the working directory work, they may be executed ... of R Programming Select the correct answer from above options...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I am getting the following message in android LogCat 03-20 01:45:03.362: WARN/System.err(369): ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 10, 2022 in Education by JackTerrance
...