Let invididual scripted targets have a separate prefix
This commit is contained in:
parent
ac8c7a11b9
commit
6a625dc18e
1
Makefile
1
Makefile
@ -72,6 +72,7 @@ dist:
|
||||
$(PACKAGE)-$(VERSION)/tests/plugin/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/tests/plugin/Makefile.Darwin \
|
||||
$(PACKAGE)-$(VERSION)/tests/plugin/Makefile.NetBSD \
|
||||
$(PACKAGE)-$(VERSION)/tests/script/Makefile.NetBSD \
|
||||
$(PACKAGE)-$(VERSION)/tests/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/tools/pkg-config.c \
|
||||
$(PACKAGE)-$(VERSION)/tools/Makefile \
|
||||
|
@ -1410,6 +1410,7 @@ static int _script_depends(Config * config, FILE * fp, String const * target);
|
||||
static int _target_script(Configure * configure, FILE * fp,
|
||||
String const * target)
|
||||
{
|
||||
String const * prefix;
|
||||
String const * script;
|
||||
|
||||
if((script = config_get(configure->config, target, "script")) == NULL)
|
||||
@ -1427,7 +1428,9 @@ static int _target_script(Configure * configure, FILE * fp,
|
||||
fprintf(fp, "\n$(OBJDIR)%s:", target);
|
||||
_script_depends(configure->config, fp, target);
|
||||
fputc('\n', fp);
|
||||
fprintf(fp, "\t%s -P \"$(PREFIX)\" -- \"$(OBJDIR)%s\"\n", script,
|
||||
if((prefix = config_get(configure->config, target, "prefix")) == NULL)
|
||||
prefix = "$(PREFIX)";
|
||||
fprintf(fp, "\t%s -P \"%s\" -- \"$(OBJDIR)%s\"\n", script, prefix,
|
||||
target);
|
||||
return 0;
|
||||
}
|
||||
@ -1657,6 +1660,7 @@ static int _write_clean(Configure * configure, FILE * fp)
|
||||
|
||||
static int _clean_targets(Config * config, FILE * fp)
|
||||
{
|
||||
String const * prefix;
|
||||
String const * p;
|
||||
String * targets;
|
||||
String * q;
|
||||
@ -1696,8 +1700,12 @@ static int _clean_targets(Config * config, FILE * fp)
|
||||
&& strcmp(p, "script") == 0
|
||||
&& (p = config_get(config, targets, "script"))
|
||||
!= NULL)
|
||||
fprintf(fp, "\t%s%s%s%s\n", p, " -c -P \"$(PREFIX)\""
|
||||
" -- \"", targets, "\"");
|
||||
{
|
||||
if((prefix = config_get(config, targets, "prefix")) == NULL)
|
||||
prefix = "$(PREFIX)";
|
||||
fprintf(fp, "\t%s%s%s%s%s%s\n", p, " -c -P \"", prefix,
|
||||
"\" -- \"", targets, "\"");
|
||||
}
|
||||
if(c == '\0')
|
||||
break;
|
||||
targets[i] = c;
|
||||
|
@ -10,7 +10,7 @@ INSTALL = install
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
$(OBJDIR)tests.log: binary/project.conf binary/Makefile.Darwin binary/Makefile.NetBSD binary/Makefile.Windows library/project.conf library/Makefile.Darwin library/Makefile.NetBSD library/Makefile.Windows plugin/Makefile.Darwin plugin/Makefile.NetBSD tests.sh
|
||||
$(OBJDIR)tests.log: binary/project.conf binary/Makefile.Darwin binary/Makefile.NetBSD binary/Makefile.Windows library/project.conf library/Makefile.Darwin library/Makefile.NetBSD library/Makefile.Windows plugin/Makefile.Darwin plugin/Makefile.NetBSD script/Makefile.NetBSD tests.sh
|
||||
./tests.sh -P "$(PREFIX)" -- "$(OBJDIR)tests.log"
|
||||
|
||||
clean:
|
||||
|
@ -1,7 +1,7 @@
|
||||
targets=tests.log
|
||||
dist=Makefile,tests.sh,binary/project.conf,binary/Makefile.Darwin,binary/Makefile.NetBSD,binary/Makefile.Windows,library/project.conf,library/Makefile.Darwin,library/Makefile.NetBSD,library/Makefile.Windows,plugin/project.conf,plugin/Makefile.Darwin,plugin/Makefile.NetBSD
|
||||
dist=Makefile,tests.sh,binary/project.conf,binary/Makefile.Darwin,binary/Makefile.NetBSD,binary/Makefile.Windows,library/project.conf,library/Makefile.Darwin,library/Makefile.NetBSD,library/Makefile.Windows,plugin/project.conf,plugin/Makefile.Darwin,plugin/Makefile.NetBSD,script/Makefile.NetBSD
|
||||
|
||||
[tests.log]
|
||||
type=script
|
||||
script=./tests.sh
|
||||
depends=binary/project.conf,binary/Makefile.Darwin,binary/Makefile.NetBSD,binary/Makefile.Windows,library/project.conf,library/Makefile.Darwin,library/Makefile.NetBSD,library/Makefile.Windows,plugin/Makefile.Darwin,plugin/Makefile.NetBSD,tests.sh
|
||||
depends=binary/project.conf,binary/Makefile.Darwin,binary/Makefile.NetBSD,binary/Makefile.Windows,library/project.conf,library/Makefile.Darwin,library/Makefile.NetBSD,library/Makefile.Windows,plugin/Makefile.Darwin,plugin/Makefile.NetBSD,script/Makefile.NetBSD,tests.sh
|
||||
|
29
tests/script/Makefile.NetBSD
Normal file
29
tests/script/Makefile.NetBSD
Normal file
@ -0,0 +1,29 @@
|
||||
TARGETS = $(OBJDIR)test
|
||||
OBJDIR =
|
||||
PREFIX = /usr/local
|
||||
DESTDIR =
|
||||
RM = rm -f
|
||||
LN = ln -f
|
||||
MKDIR = mkdir -m 0755 -p
|
||||
INSTALL = install
|
||||
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
$(OBJDIR)test:
|
||||
./script.sh -P "/somewhere/else" -- "$(OBJDIR)test"
|
||||
|
||||
clean:
|
||||
$(RM) -- $(test_OBJS)
|
||||
./script.sh -c -P "/somewhere/else" -- "test"
|
||||
|
||||
distclean: clean
|
||||
$(RM) -- $(TARGETS)
|
||||
|
||||
install: $(TARGETS)
|
||||
./script.sh -P "$(DESTDIR)/somewhere/else/again" -i -- "$(OBJDIR)test"
|
||||
|
||||
uninstall:
|
||||
./script.sh -P "$(DESTDIR)/somewhere/else/again" -u -- "test"
|
||||
|
||||
.PHONY: all clean distclean install uninstall
|
8
tests/script/project.conf
Normal file
8
tests/script/project.conf
Normal file
@ -0,0 +1,8 @@
|
||||
targets=test
|
||||
dist=Makefile
|
||||
|
||||
[test]
|
||||
type=script
|
||||
script=./script.sh
|
||||
prefix=/somewhere/else
|
||||
install=/somewhere/else/again
|
@ -102,5 +102,6 @@ _test "Darwin" "plugin"
|
||||
_test "NetBSD" "binary"
|
||||
_test "NetBSD" "library"
|
||||
_test "NetBSD" "plugin"
|
||||
_test "NetBSD" "script"
|
||||
_test "Windows" "binary"
|
||||
_test "Windows" "library") > "$target"
|
||||
|
Loading…
Reference in New Issue
Block a user