Skip to main content
GameDev.net gamedev.net
🔒 Locked

[solved] "make" question

Started by ronnybrendel May 24, 2006 at 12:43 PM 2 replies 650+ views
Original Post
ronnybrendel
ronnybrendel
------------------------------ question: why does he not have a look at fileactuality? ( it compiles the file over and over again ... without looking if its changed or not ... ) ------------------------------ CC= icc CFLAGS= -g -O0 -Wall -Werror AR= ar DEBUG= yes PROJECTNAME= test VERSION_MAJOR= 0 VERSION_MINOR= 0 VERSION_SUB= 0 SRCDIR= src SOURCES= test.c HEADERS= test.h TARGET= lib$(PROJECTNAME).a OBJECTS= $(SOURCES:.c=.o) #create debug macro-def ifeq "$(DEBUG)" "yes" CFLAGS+= -DDXML_DEBUG endif all: $(SOURCES) $(OBJECTS) @echo 'creating $(TARGET)'; #create the archive index @$(AR) -s $(TARGET); #compile everything %.c: $(CC) $(CFLAGS) -c $(SRCDIR)/$@ -o $(SRCDIR)/$*.o %.o: #add all objects to the library @$(AR) -csr $(TARGET) $(SRCDIR)/$@ [Edited by - ronnybrendel on May 24, 2006 1:29:22 PM]
mmelson
mmelson
It's been a long time since I've used makefiles, but I remember having that problem before, and it usually (always?) was caused by the source file having a date from sometime in the future. I had this problem often when I was editing the code on my machine, but compiling on another.
JohnBolton
JohnBolton
It's been a while, but it appears that your rules are not set up correctly. I think this is how you want to do it:
    # Rule that builds everything    all: $(TARGET)        # Rule that builds the library from .o files    $(TARGET): $(OBJECTS)        @$(AR) -csr $(TARGET) $<        # Rule that builds .o files from .c files    %.o: %.c        $(CC) $(CFLAGS) -c $< -o $@ 
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
ronnybrendel
ronnybrendel
nevermind i found it :) big thanks :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.