diff --git a/src/makefile.c b/src/makefile.c index 2751c1a..41f9b82 100644 --- a/src/makefile.c +++ b/src/makefile.c @@ -2124,14 +2124,17 @@ static void _install_target_script(Configure * configure, FILE * fp, { String const * path; String const * script; + int phony; if((path = config_get(configure->config, target, "install")) == NULL) return; if((script = config_get(configure->config, target, "script")) == NULL) return; - fprintf(fp, "\t%s%s%s%s%s%s", script, " -P \"$(DESTDIR)", + phony = _makefile_is_phony(configure, target); + fprintf(fp, "\t%s%s%s%s%s%s%s", script, " -P \"$(DESTDIR)", (path[0] != '\0') ? path : "$(PREFIX)", - "\" -i -- \"$(OBJDIR)", target, "\"\n"); + "\" -i -- \"", phony ? "" : "$(OBJDIR)", target, + "\"\n"); } static int _install_include(Config * config, FILE * fp, String const * include); diff --git a/tests/script/Makefile.NetBSD b/tests/script/Makefile.NetBSD index 987c850..0d105d4 100644 --- a/tests/script/Makefile.NetBSD +++ b/tests/script/Makefile.NetBSD @@ -26,8 +26,10 @@ distclean: clean install: $(TARGETS) ./script.sh -P "$(DESTDIR)/somewhere/else/again" -i -- "$(OBJDIR)test" + ./script.sh -P "$(DESTDIR)$(PREFIX)" -i -- "phony" uninstall: ./script.sh -P "$(DESTDIR)/somewhere/else/again" -u -- "test" + ./script.sh -P "$(DESTDIR)$(PREFIX)" -u -- "phony" .PHONY: all clean distclean install uninstall phony diff --git a/tests/script/project.conf b/tests/script/project.conf index 391657a..1311050 100644 --- a/tests/script/project.conf +++ b/tests/script/project.conf @@ -11,3 +11,4 @@ install=/somewhere/else/again type=script script=./script.sh phony=1 +install=