premake / premake/premake-core

Make warnings if objdir and targetdir point to the same directory

Open
#726 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug gmake
Dominant language
C
Stars
3.6k
Forks
654
Avg merge
1d 1h
Merged PRs (30d)
13

Description

As the title says, if objdir and targetdir point to the same directory, then we'll get some errors:

Basic.C.make:72: warning: overriding commands for target `.'
Basic.C.make:64: warning: ignoring old commands for target `.'

This makes sense if we look at the makefile:

$(TARGETDIR):
	@echo Creating $(TARGETDIR)
ifeq (posix,$(SHELLTYPE))
	$(SILENT) mkdir -p $(TARGETDIR)
else
	$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
endif

...

$(OBJDIR):
	@echo Creating $(OBJDIR)
ifeq (posix,$(SHELLTYPE))
	$(SILENT) mkdir -p $(OBJDIR)
else
	$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
endif

If the directories are the same, then only one of these targets needs to be generated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the generated Makefile rules for TARGETDIR and OBJDIR shown in the issue. Confirm how generation behaves when both variables resolve to the same directory, then verify that only one directory target rule is emitted and the duplicate-target warnings disappear.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.