I'm using ExtUtils::MakeMaker to package my perl module but I don't want the makefile to copy files anywhere on the system. I need to disable the "install" target and instead tell the user that this makefile only supports "make dist" when he types "make install".
Asked
Active
Viewed 157 times
2
-
1Just curious: Why not let the user run `make install` if they want to? Otherwise, how would they use your modules you're producing? – David W. Feb 23 '15 at 21:21
-
Because the application is dependent on several system administration choices like "Which database backend am I going to use", etc. and just copying the modules to any directory on the system makes no real sense. I'm just offering the Makefile.PL as a helper module for Linux distributions modules packagers. – Michal T Feb 23 '15 at 21:29
1 Answers
1
Define MY::install
in your Makefile.PL
file:
sub MY::install {
"install ::\n\techo You should run \\'make dist\\', not \\'make install\\'"
}
The function should return the text you want to use to replace the install
section of the Makefile.
You could make make install
a synonym for make dist
with:
sub MY::install [ "install :: dist\n" }

mob
- 117,087
- 18
- 149
- 283
-
A slightly updated version of your answer is exactly what I was looking for: `sub MY::install { "install ::\n\t\$(info You should run 'make dist', not 'make install')" } ` Thanks – Michal T Feb 23 '15 at 21:44
-
I was just going to suggest putting `PREFIX => '/dev/null,` in the `WriteMakefile` structure. You can run `make install`, but it won't work. Nice to know you can actually override the targets themselves. – David W. Feb 23 '15 at 21:47