deadpixi / mtm

Perhaps the smallest useful terminal multiplexer in the world.
1.12k stars 53 forks source link

Makefile-alt with CURSESCFLAGS and CURSESLIBS options #45

Open Hibou57 opened 4 years ago

Hibou57 commented 4 years ago

An additional and alternate Makefile, better suited to people using pkg-config for their ncursesw library (the one on my Ubuntu 16.04 32bits is obsolete, it is still v5 while MTM expects v6). I could have added an invocation to pkg-config directly in the Makefile, but it makes it more general if it just uses two CURSESCFLAGS and CURSESLIBS options which can freely be set on invocation.

Example usage:

make CURSESCFLAGS="$(pkg-config --cflags ncursesw)" \
   CURSESLIBS="$(pkg-config --libs ncursesw)"

Note CURSESLIBS is not always just a matter of paths, it may be a matter of linker options. Ex for me, what pkg-config says about ncursesw, is:

$ pkg-config --cflags ncursesw
> -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -I/home/…/apps/ncurses/include/ncursesw -I/home/…/apps/ncurses/include
$ pkg-config --libs ncursesw
> -L/home/…/apps/ncurses/lib -Wl,-rpath,/home/…/apps/ncurses/lib -lncursesw

Note the -Wl,-rpath … part, which is why a library path is not always enough. For a custom ncurses library, an -I… option is also required for the C compilation.

This is why I’m proposing an additional and alternate Makefile, with CURSESCFLAGS and CURSESLIBS options.

paulmenzel commented 3 years ago

I’d squash the second into the first commit, but besides that, that’s also what I need for my environment.