Skip to content

Commit 801e7d7

Browse files
committed
Guard .PHONY targets with directory check
1 parent 050fd75 commit 801e7d7

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

lib/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ ALL_OBJ += $(TOSLIBC_LIB_OBJ)
9292
$(TOSLIBC): $(TOSLIBC_LIB_OBJ)
9393
$(QUIET_AR)$(TARGET_AR) rcs $@ $^
9494

95+
OTHER_CLEAN += $(TOSLIBC)
96+
97+
ifeq (lib/,$(TOSLIBC_lib_dir))
98+
9599
.PHONY: lib
96100
lib: $(TOSLIBC)
97101

@@ -112,4 +116,4 @@ install-lib-static: $(TOSLIBC)
112116
$(INSTALL) -d -m 755 $(DESTDIR)$(libdir)
113117
$(INSTALL) $(TOSLIBC) $(DESTDIR)$(libdir)
114118

115-
OTHER_CLEAN += $(TOSLIBC)
119+
endif

script/Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ TOSLIBC_SCRIPT_PRG_LD = $(TOSLIBC_script_dir)prg.ld
2727
$(TOSLIBC_SCRIPT_PRG_LD): $(TOSLIBC_script_dir)target-prg.ld
2828
$(QUIET_GEN)$< $@
2929

30-
.PHONY: script
31-
script: $(TOSLIBC_SCRIPT_TARGET_CC) $(TOSLIBC_SCRIPT_TARGET_LD) \
30+
OTHER_CLEAN += $(TOSLIBC_SCRIPT_TARGET_CC) $(TOSLIBC_SCRIPT_TARGET_LD) \
3231
$(TOSLIBC_PC) $(TOSLIBC_SCRIPT_PRG_LD)
3332

34-
OTHER_CLEAN += $(TOSLIBC_SCRIPT_TARGET_CC) $(TOSLIBC_SCRIPT_TARGET_LD) \
33+
ifeq (script/,$(TOSLIBC_script_dir))
34+
35+
.PHONY: script
36+
script: $(TOSLIBC_SCRIPT_TARGET_CC) $(TOSLIBC_SCRIPT_TARGET_LD) \
3537
$(TOSLIBC_PC) $(TOSLIBC_SCRIPT_PRG_LD)
3638

3739
.PHONY: install-linker-script
@@ -53,3 +55,5 @@ install-pkg-config: $(TOSLIBC_PC)
5355
install-prg.ld-script: $(TOSLIBC_SCRIPT_PRG_LD)
5456
$(INSTALL) -d -m 755 $(DESTDIR)$(ldscriptdir)
5557
$(INSTALL) -m 644 $< $(DESTDIR)$(ldscriptdir)
58+
59+
endif

tool/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ $(TOSLINK_OBJ): %.o: %.c
3333
$(TOSLINK): $(TOSLINK_OBJ)
3434
$(QUIET_LINK)$(CC) $(TOSLINK_CFLAGS) -o $@ $^
3535

36+
OTHER_CLEAN += $(TOSLINK) $(TOSLIBC_VERSION_SRC)
37+
38+
ifeq (tool/,$(TOSLIBC_tool_dir))
39+
3640
.PHONY: tool
3741
tool: $(TOSLINK)
3842

@@ -64,4 +68,4 @@ install-compiler-alias: install-compiler-script
6468
$(INSTALL) -d $(DESTDIR)$(compilerbindir)
6569
@script/install-compiler-symlink -v -a $(compilerbindir) $(COMPILER_ALIASES)
6670

67-
OTHER_CLEAN += $(TOSLINK) $(TOSLIBC_VERSION_SRC)
71+
endif

0 commit comments

Comments
 (0)