From 2fba9848aeb5d312f41e48aa6355cb5dcc9cced7 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Sun, 20 Dec 2020 21:34:43 +0200 Subject: [PATCH] In case native GCC is missing, inform user --- tools/bin2c/Makefile | 4 ++++ tools/lz/Makefile | 4 ++++ tools/lz/lz77.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/bin2c/Makefile b/tools/bin2c/Makefile index 303f322..2e64db4 100644 --- a/tools/bin2c/Makefile +++ b/tools/bin2c/Makefile @@ -1,5 +1,9 @@ NATIVE_CC ?= gcc +ifeq (, $(shell which $(NATIVE_CC) 2>/dev/null)) +$(error "Native GCC is missing. Please install it first. If it's path is custom, set it with export NATIVE_CC=") +endif + .PHONY: all clean all: bin2c diff --git a/tools/lz/Makefile b/tools/lz/Makefile index 8ffabde..6a70564 100644 --- a/tools/lz/Makefile +++ b/tools/lz/Makefile @@ -1,5 +1,9 @@ NATIVE_CC ?= gcc +ifeq (, $(shell which $(NATIVE_CC) 2>/dev/null)) +$(error "Native GCC is missing. Please install it first. If it's path is custom, set it with export NATIVE_CC=") +endif + .PHONY: all clean all: lz77 diff --git a/tools/lz/lz77.c b/tools/lz/lz77.c index 812ae8d..9ab159d 100644 --- a/tools/lz/lz77.c +++ b/tools/lz/lz77.c @@ -33,7 +33,7 @@ int main(int argc, char *argv[]) if(stat(argv[1], &statbuf)) goto error; - if((in_file=fopen(argv[1], "r")) == NULL) + if((in_file=fopen(argv[1], "rb")) == NULL) goto error; strcpy(filename, argv[1]);