make the utility to be universal from 10.13 upto now

Signed-off-by: Slice <sergey.slice@gmail.com>
This commit is contained in:
Slice 2023-09-15 19:50:48 +03:00
parent d21d5b2e65
commit bf4fb452dc
2 changed files with 7 additions and 7 deletions

View File

@ -14,8 +14,8 @@ PROG := $(addprefix $(UTILSDIR)/, $(PROGRAM))
all: $(PROG)
$(PROG): $(SRC)
@echo "\t[CXX] $(PROGRAM)"
@cc -o $(PROGRAM) $(PROGRAM).c -framework CoreFoundation -framework IOKit -Wall >/dev/null
@echo "\t[CLANG] $(PROGRAM)"
@clang -o $(PROGRAM) $(PROGRAM).c -framework CoreFoundation -framework IOKit -mmacosx-version-min=10.13 >/dev/null
@mv $(PROGRAM) $(UTILSDIR)
install-local: $(PROG)

View File

@ -20,7 +20,7 @@
* @APPLE_LICENSE_HEADER_END@
*/
/*
cc -o nvram nvram.c -framework CoreFoundation -framework IOKit -Wall
clang nvram2.c -o nvram3 -framework CoreFoundation -framework IOKit -mmacosx-version-min=10.13
*/
// https://github.com/apple-oss-distributions/system_cmds/blob/13d383ddb305dc1672243e5384ba18b58949cc2c/nvram.tproj/nvram.c
@ -121,11 +121,11 @@ int main(int argc, char **argv)
int argcount = 0;
#if defined(MAC_OS_VERSION_12_0)
result = IOMainPort(bootstrap_port, &mainPort);
#else
//#if defined(MAC_OS_VERSION_12_0)
// result = IOMainPort(bootstrap_port, &mainPort);
//#else
result = IOMasterPort(bootstrap_port, &mainPort);
#endif
//#endif
if (result != KERN_SUCCESS) {
errx(1, "Error getting the IOMainPort: %s",
mach_error_string(result));