I would like to compile less with latest fixes.

I do this:

git clone https://github.com/gwsw/less
cd less/

But make says this:

make: *** No rule to make target 'funcs.h', needed by 'main.o'. Stop.

There are no Makefile rules that create funcs.h

So, how to compile less from source?

  • Then what happened? Sep 11, 2018 at 11:11
  • It seems running make -f Makefile.aut funcs.h before make fixes the problem. But I'm not sure if this sequence is correct. Sep 17, 2018 at 8:21

4 Answers 4


As explained in Thomas Dickey’s answer, the git repository needs preparation before it can be used to build, and one required file can’t be recreated using the provided files.

To build less, download its latest release tarball and build that:

wget http://greenwoodsoftware.com/less/less-530.tar.gz
tar xf less-530.tar.gz
cd less-530
./configure && make

Note however that version 530 has a few annoying bugs which are fixed in the git repository. (This could be why the Debian package hasn’t been updated.)

Alternatively, you can update the Debian package:

sudo apt build-dep less
sudo apt install devscripts
apt source less
cd less-487
cd ..
tar xf less_530.orig.tar.gz
cd less-530
cp -a ../less-487/debian .
dch -v 530-0.1 "New upstream release."
dch -r ignored
debuild -uc -uc

This will produce a less_530-0.1_yourarch.deb (where yourarch is probably amd64), which you can install using sudo dpkg -i. As JdeBP points out, this will ensure that the Debian patches are applied, and that the appropriate configure options are used; it will also give you the benefits of using a package instead of a manual installation.

For gbp fans like myself, the following recipe uses a git repository which makes any changes more obvious:

sudo apt build-dep less
sudo apt install devscripts git-buildpackage
gbp import-dsc --pristine-tar apt://less/sid
cd less
gbp import-orig --pristine-tar --uscan
dch -v 530-0.1 "New upstream release."
dch -r ignored
gbp buildpackage -us -uc --git-ignore-new

(In both cases, strictly speaking you should use dch -n and dch -v, or at least add “Non-maintainer upload.” to the changelog, but that’s harder to do in a copy-pastable way.)


"Makefile.in" is an input to "configure", which generates "Makefile". You need not specify "Makefile" in the make-command. So this should work better:


(though you may have left files in that directory which should be removed before re-running configure).

Running from git, you're missing the distribution files such as configure. If you have a suitable version of autoconf installed, you would have to prepare the build by first running


However, the git tree also omits "defines.h.in" — more preparation is needed: none of the files in git appears to match the needed template. You might be able to reuse the corresponding file from a release tar-ball, though that's unreliable (like any other source-file, it changes). Since the documentation doesn't mention this step, a bug report to the developer might help.

The revised question asks about funcs.h, which can be created using the rule in Makefile.aut ("Makefile for authoring less", according to the comment at the top of the file). But as of 2018/09/17, there still is no rule to create defines.h.in (use grep to answer these questions).

  • I've sent bug report. Sep 12, 2018 at 7:43
  • Running autoheader before autoconf seems to help. But make says make: *** No rule to make target 'funcs.h', needed by 'main.o'. Stop. ... Sep 15, 2018 at 14:58
  • There's a makefile rule for creating that file (the makefile doesn't have dependencies telling it to make the file before trying to compile). Sep 15, 2018 at 16:14
  • There are no Makefile targets that create funcs.h. Sep 17, 2018 at 3:01
  • Take a look in Makefile.aut (grep helps). Sep 17, 2018 at 8:04

Here's the method I just successfully used on Ubuntu 18.04:

  • git clone https://github.com/gwsw/less.git
  • cd less
  • autoreconf -i # install the autoconf package if you haven't already
  • make -f Makefile.aut dist

This creates a directory release/less-550 containing less-550.tar.gz and less-550.zip. It also attempts to create a gpg signature for less-550.tar.gz. That hung on my system, so I killed the gpg --detach-sign ... process from another window. You could also just kill the make process.

less-550.tar.gz is a standard buildable source tarball, which you can install as usual:

  • tar xf less-550.tar.gz
  • cd less-550
  • ./configure --prefix=some-directory other-options
  • make
  • make install

The most interesting options for ./configure are probably:

--with-regex=LIB        select regular expression library
                        (LIB is one of
                         regcmp,re_comp,regcomp,regcomp-local) [auto]
--with-editor=PROGRAM   use PROGRAM as the default editor [vi]

Run ./configure --help for a full list of options.


This sequence does the job, but I'm not sure that it is correct:

git clone https://github.com/gwsw/less
cd less/
make -f Makefile.aut funcs.h
make -f Makefile.aut less.nro
make -f Makefile.aut lesskey.nro
make -f Makefile.aut lessecho.nro
make install

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .