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

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    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, 11: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-27-2005, 12:07 AM
  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, 03:15 PM