Fix mac build more generically and cleaner.

This commit is contained in:
Jonathan Woodruff
2025-03-10 17:10:41 +00:00
parent 8dd73525de
commit 03b8face1e
2 changed files with 3 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ CFLAGS = -g -o elf_to_hex elf_to_hex.c -lelf
ifeq ($(uname_S), Darwin)
CC = clang++
APPLE_FLAGS = -I /opt/homebrew/lib -I /opt/homebrew/Cellar/libelf/0.8.13_1/include/
APPLE_FLAGS = -L /opt/homebrew/lib -I /opt/homebrew/include/libelf -I /opt/homebrew/include
endif
elf_to_hex: elf_to_hex.c
@@ -26,4 +26,4 @@ clean:
.PHONY: full_clean
full_clean:
rm -f *~ elf_to_hex
rm -f *~ elf_to_hex

View File

@@ -43,15 +43,12 @@
#include <inttypes.h>
#include <string.h>
#include <fcntl.h>
#include <gelf.h>
#ifdef __APPLE__
#include <libelf/gelf.h>
#include <vector>
#else
#include <gelf.h>
#endif
// ================================================================
// Memory buffer into which we load the ELF file before
// writing it back out to the output file.