htop icon indicating copy to clipboard operation
htop copied to clipboard

Perhaps a dumb question about compiling.

Open Alex313031 opened this issue 3 years ago • 2 comments

I love htop and have been compiling it from here for forever. Usual thing is sudo make uninstall, then re download the repo as a zip, and ./autogen, ./configure --enable-hwloc, make, and sudo make install.

I would however, like to optimize it as much as possible, by stripping with -s, using -O3 instead of -O2, and setting -march=haswell for my system. Can i just edit the makefile after ./configure and change the AM_CPPFLAGS = and CFLAGS = lines to include these, or should i use make with CFLAGS = {$CFLAGS} -s -O3 -march=haswell, or does htop have support for the ADDFLAGS variable?

Alex313031 avatar Feb 07 '22 03:02 Alex313031

@Alex313031 You can override the CFLAGS and CPPFLAGS variables at configure time, by specifying the variables as arguments to ./configure. For example: ./configure --enable-hwloc 'CFLAGS= -s -O3 -march=native'

This technique works with all Autotools-based configure scripts. It's not a good idea to manually edit the Makefile as the file is auto-generated and will be deleted after make distclean.

Explorer09 avatar Feb 07 '22 06:02 Explorer09

@Explorer09 Nice to know. However, I always do a sudo make uninstall followed by a deletion of the entire htop tree and redownload for every time I build. In that case is it ok to just edit the makefile?

Alex313031 avatar Feb 14 '22 06:02 Alex313031