Not long ago, Mr. Zhu asked me to write a spec
I haven’t written about spec before. I don’t know what it is. I checked a lot of blogs about spec on the Internet. I encountered many pits, but the biggest pit was make install in the% install part
The information on the Internet says:
This segment is the install segment, which contains commands that will be executed when installing packages, such as the make install command. %makeinstall This is not a keyword, but a standard macro command defined by rpm. It can also be written in a non-standard way: quoting make DESTDIR=$RPM_BUILD_ROOT install or quoting make prefix=$RPM_BUILD_ROOT install It should be noted that %install here is mainly for the %file that follows. So, you can also use the regular system commands: quote install -d $RPM_BUILD_ROOT/ cp -a * $RPM_BUILD_ROOT/
But every time I use make install, I will report an error: Make: * * * no rule to make target ‘install’. Just write install – d instead. I don’t understand why
Later, it was found that use make install on the premise that the makefile has been written. The install in the error report is actually the written target in the makefile
For example, it is written in makefile as follows:
install-oem: mkdir -p $(LIBDIR)/xsconsole/plugins-oem
You can write this in% install:
%install make install-oem DESTDIR=$RPM_BUILD_ROOT
Otherwise, of course, an error will be reported and the target cannot be found
Mr. Zhu said that using makefile is a little out of date now. I think makefile is very annoying. If it is wrong, I have to repackage it and generate a compressed file. After many changes, I can’t stand it at all. It’s better to write content directly in% install, which is also convenient to change