tanelpoder / 0xtools

0x.Tools: X-Ray vision for Linux systems
https://0x.tools
GNU General Public License v2.0
1.41k stars 107 forks source link

Modify Makefile to better accommodate cross compilation #31

Closed bertofurth closed 1 year ago

bertofurth commented 2 years ago

Thanks for creating this valuable tool.

Can I suggest some minor changes to the Makefile that will make it much easier to cross compile your useful tool?

These will more easily allow people to specify an alternate compiler (CC) and installation destination (PREFIX)

--- Makefile.orig       2022-09-23 12:06:14.876630117 +1000
+++ Makefile    2022-09-23 12:09:03.834063588 +1000
@@ -1,8 +1,8 @@
-CC=gcc
+CC ?= gcc
 PREFIX ?= /usr

 # build
-CFLAGS=-I include -Wall
+CFLAGS ?= -Wall

 # debuginfo included
 CFLAGS_DEBUG=-I include -ggdb -Wall
@@ -11,7 +11,7 @@
 CFLAGS_DEBUG0=-I include -ggdb -O0

 all:
-       $(CC) $(CFLAGS) -o bin/xcapture src/xcapture.c
+       $(CC) $(CFLAGS) -I include -o bin/xcapture src/xcapture.c

 debug:
        $(CC) $(CFLAGS_DEBUG) -o bin/xcapture src/xcapture.c
@@ -20,6 +20,7 @@
        $(CC) $(CFLAGS_DEBUG0) -o bin/xcapture src/xcapture.c

 install:
+       install -m 0755 -d ${PREFIX}/bin
        install -m 0755 bin/xcapture ${PREFIX}/bin/xcapture
        install -m 0755 bin/psn ${PREFIX}/bin/psn
        install -m 0755 bin/schedlat ${PREFIX}/bin/schedlat
tanelpoder commented 2 years ago

Thanks for the improvement!

I'll test & include this into the next version too. (Still being a bit swamped time-wise, but have a full-week vacation coming up soon where I intend to work on this project :-)

bertofurth commented 2 years ago

No hurry! Thanks for your work on this project! Have a great vacation.

Berto.

On Fri, 23 Sep 2022, at 14:34, Tanel Poder wrote:

Thanks for the improvement!

I'll test & include this into the next version too. (Still being a bit swamped time-wise, but have a full-week vacation coming up soon where I intend to work on this project :-)

— Reply to this email directly, view it on GitHub https://github.com/tanelpoder/0xtools/issues/31#issuecomment-1255791653, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM3N3NAZJ6NRRR2QRBHDVI3V7UXLRANCNFSM6AAAAAAQTS5XTQ. You are receiving this because you authored the thread.Message ID: @.***>

tanelpoder commented 1 year ago

Added into v1.2.3

bertofurth commented 1 year ago

Well done! Thanks!