I have written a very simple
$ cat Makefile install_path=/usr/local/bin script_name_1=encrypt-file-aes256 script_name_2=decrypt-file-aes256 .PHONY: install .PHONY: uninstall install: install -m 0755 -o root -g root -t $(install_path) $(script_name_1) $(script_name_2) uninstall: rm $(install_path)/$(script_name_1) $(install_path)/$(script_name_2)
It works like a charm on Linux Mint 18.3 I have tested it on.
But not in
Cygwin; this is what I get as an error
$ make install install -m 0755 -o root -g root -t /usr/local/bin encrypt-file-aes256 decrypt-file-aes256 install: invalid user ‘root’ make: *** [Makefile:9: install] Error 1
I know there is no
root user in
Cygwin, but have no idea how to fix it.
How to generalize the
Makefile for it to work in
Cygwin as well as on Linux?
Important comments integrated and answered here
What happens if you drop the
-goptions completely on the
Then it works well, but the user and group would be wrong on a Linux system, I suppose.
Hard-coding a user and group name seems like a bad idea.
I admit I did not think of that, and when I now contemplate on it, I think that too.
I would recommend that you don't hard-code the installation path.
This is a lovely idea, and yes, I agree, let the user decide where he installs it.
How are you invoking this
As normal user with
sudo make install.
If you get line 9 to work outside of
make, then it will work. It is not a
I know it is not a
makeproblem. I just did not know how to generalize the
Makefilefor it to work in