g++ makefile acting weird with objects in a folder...

This is a discussion on g++ makefile acting weird with objects in a folder... within the Tech Board forums, part of the Community Boards category; I have a pretty simple makefile setup, I'm using mingw32 on a windows box. Code: CXX = g++ $(CFLAGS) all: ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    37

    g++ makefile acting weird with objects in a folder...

    I have a pretty simple makefile setup, I'm using mingw32 on a windows box.

    Code:
    CXX = g++ $(CFLAGS)
    
    all: adventure.exe
    
    debug: CFLAGS = -g
    debug: adventure.exe
    
    adventure.exe: main.o Dictionary.o GameManager.o Object.o Room.o
    	$(CXX) main.o Dictionary.o GameManager.o Object.o Room.o -o adventure.exe
    
    main.o: main.cpp
    	$(CXX) -c main.cpp -o main.o
    
    Dictionary.o: src\\Dictionary.cpp
    	$(CXX) -c src\\Dictionary.cpp -o Dictionary.o
    
    GameManager.o: src\\GameManager.cpp
    	$(CXX) -c src\\GameManager.cpp -o GameManager.o
    	
    Object.o: src\\Object.cpp
    	$(CXX) -c src\\Object.cpp -o Object.o
    
    Room.o: src\\Room.cpp
    	$(CXX) -c src\\Room.cpp -o Room.o
    
    clean:
    	del *.o adventure.exe
    This generates all the .o files in the same root folder, make all, debug, clean all work fine, and when I run make it will only rebuild the dependencies if a file has been modified like I've seen on linux.

    Now if I put the object files into a folder called "objs", and rebuild it will always rebuild even if I haven't modified any of the source/headers.

    Is there a trick to getting this to work with the objects in a folder on a windows box? This is driving me crazy!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,490
    Did you change all the relative paths?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    If you posted the actual makefile it would help...
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Floating Values acting weird.
    By torqu3e in forum C Programming
    Replies: 9
    Last Post: 12-19-2006, 10:12 AM
  2. atof() acting weird?
    By Mellowz in forum C Programming
    Replies: 4
    Last Post: 07-09-2006, 03:48 AM
  3. DirectX 9 materials acting weird
    By Rune Hunter in forum Game Programming
    Replies: 7
    Last Post: 12-26-2005, 11:07 PM
  4. char[] acting weird
    By Leeman_s in forum C++ Programming
    Replies: 3
    Last Post: 06-09-2003, 06:45 PM
  5. n00b needs help with api graphics acting very weird
    By CheeseWeaver in forum Windows Programming
    Replies: 2
    Last Post: 03-18-2003, 02:15 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21