Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7869407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:18:36+00:00 2026-06-03T01:18:36+00:00

I’ve been trying for over an hour to fix my makefile but I break

  • 0

I’ve been trying for over an hour to fix my makefile but I break more than I fix. Anyhow, I’m pretty (very) new to Makefiles and I have little to no experience. My problem is that my makefile recompiles every single source file even if the object files already been built (and the source haven’t been updated). Since makefile is quite like declarative programming I have no idea what I am doing wrong or right.

Sorry for the short description buy my knowledge in this area is very limited…

#---------------------------------------------------------
# Compiler and linker flags
#---------------------------------------------------------

CC      =   g++
CMNFLAGS    =   -ggdb3 -Wextra -Wall -Wno-int-to-pointer-cast -Wno-reorder -Wno-    write-strings -DOPT_TYPE="\"debugging\""
CFLAGS      =   $(CMNFLAGS) -fPIC
LDFLAGS     =   $(CMNFLAGS) -shared -ldl -lm -static-libgcc

#---------------------------------------------------------
# All the different directories
#---------------------------------------------------------

BUILD       =   build
SOURCE      =   source
INCLUDE     =   include
TARGET      =   $(BUILD)/$(shell basename $(CURDIR))_mm_i386.so

#---------------------------------------------------------
# Directory and include variables/files
#---------------------------------------------------------

SRCSDK      =   ../sdk
METADIR     =   $(INCLUDE)/metafiles

INSTDIR     =   /usr/local/test/$(shell basename $(CURDIR))/dlls
INCLUDES    =   -I$(INCLUDE) -I$(METADIR) -I$(SRCSDK)/engine -I$(SRCSDK)/common \
        -I$(SRCSDK)/pm_shared -I$(SRCSDK)/dlls -I$(SRCSDK)

#---------------------------------------------------------
# Special variables
#---------------------------------------------------------

VPATH       =   $(SOURCE) $(foreach dir, $(MODULES), $(SOURCE)/$(dir))

#---------------------------------------------------------
# Source and object files
#---------------------------------------------------------

MODULES     =   game

SRC_DIR     =   $(addprefix $(SOURCE)/, $(MODULES))
SOURCES     =   $(foreach dir, $(SRC_DIR), $(wildcard $(dir)/*.cpp))

SOURCES     +=  $(wildcard $(SOURCE)/*.cpp)
OBJECTS     =   $(foreach dir, $(SOURCES:.cpp=.o), $(BUILD)/$(notdir $(dir)))

#---------------------------------------------------------
# All the makefile directives
#---------------------------------------------------------

.PHONY: clean install

all: $(SOURCES) $(TARGET)

$(TARGET): $(OBJECTS)
  $(CC) $(LDFLAGS) $(OBJECTS) -o $@

$(BUILD)/%.o: %.cpp $(BUILD)
  $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $<

$(BUILD):
  @mkdir $@

clean:
  -rm -r $(BUILD)
  @echo clean...

install: $(TARGET)
  @cp $(TARGET) $(INSTDIR)
  @echo installation done...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:18:38+00:00Added an answer on June 3, 2026 at 1:18 am
    $(BUILD)/%.o: %.cpp $(BUILD)
    

    should be

    $(BUILD)/%.o: %.cpp
    

    Your line says that your object files are built from the directory which contains them. Almost any action will update the timestamp of your build directory, so you objects are almost always out of date.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.