Find the answer to your Linux question:
Results 1 to 2 of 2
Hi all I have a problem with my makefile. I have the makefile in the directory 'source' and I want to have the compiled program in an other directory, something ...
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Location
    Belgium
    Posts
    4

    [SOLVED] Makefile - destination directory

    Hi all

    I have a problem with my makefile. I have the makefile in the directory 'source' and I want to have the compiled program in an other directory, something like 'bin' or so.

    This is the makefile like it is now:

    Code:
    COMPILER = gcc
    CCFLAGS = -Wall -g `xml2-config --cflags`
    LIBS = `xml2-config --libs`
     
    main: main.o stack.o
    	${COMPILER} ${CCFLAGS} ${LIBS}  -o main main.o stack.o
    
    main.o: main.c
    	${COMPILER} ${CCFLAGS} ${LIBS}  -c main.c
    
    stack.o: stack.c
    	${COMPILER} ${CCFLAGS} ${LIBS}  -c stack.c
    Thx

  2. #2
    Just Joined!
    Join Date
    Mar 2010
    Location
    Belgium
    Posts
    4
    Ok

    I found it myself.
    I put the makefile in the destination directory. And change the makefile like this:
    Code:
    COMPILER = gcc
    CCFLAGS = -Wall -g `xml2-config --cflags`
    LIBS = `xml2-config --libs`
    DIR = /home/workspace/project/source/
     
    main: main.o stack.o
    	${COMPILER} ${CCFLAGS} ${LIBS}  -o main main.o stack.o
    
    main.o: {DIR}main.c
    	${COMPILER} ${CCFLAGS} ${LIBS}  -c {DIR}main.c
    
    stack.o: {DIR}stack.c
    	${COMPILER} ${CCFLAGS} ${LIBS}  -c {DIR}stack.c

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...