From ffa40635425e83c7971522dfcb215e2f8c09f9c6 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Mon, 3 Aug 2020 21:18:05 +0200
Subject: pre-generate deps

This requires gcc8, but the other buildsteps shouldn't need it

diff --git a/dep/fwcutter.d b/dep/fwcutter.d
new file mode 100644
index 0000000..05af350
--- /dev/null
+++ b/dep/fwcutter.d
@@ -0,0 +1,2 @@
+dep/fwcutter.d obj/fwcutter.o: fwcutter.c md5.h fwcutter.h \
+ fwcutter_list.h
diff --git a/dep/md5.d b/dep/md5.d
new file mode 100644
index 0000000..abd9682
--- /dev/null
+++ b/dep/md5.d
@@ -0,0 +1 @@
+dep/md5.d obj/md5.o: md5.c md5.h
-- 
2.27.0


From 9caca2494686ebb661d8f421d0bcf4e08c309d90 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Mon, 3 Aug 2020 21:26:24 +0200
Subject: Fix build in haiku and with gcc2


diff --git a/Makefile b/Makefile
index 264b97d..7b6737e 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ endif
 
 PREFIX ?= /usr/local
 CFLAGS		?= -Os -fomit-frame-pointer
-CFLAGS		+= -std=c99 -Wall -pedantic -D_BSD_SOURCE
+CFLAGS		+= -std=gnu9x -Wall -pedantic -D_BSD_SOURCE
 LDFLAGS		?=
 
 SRCS = fwcutter.c md5.c
diff --git a/fwcutter.c b/fwcutter.c
index 294502b..e9e9304 100644
--- a/fwcutter.c
+++ b/fwcutter.c
@@ -42,6 +42,10 @@
 #include <sys/endian.h>
 #elif defined(__APPLE__)
 #include <libkern/OSByteOrder.h>
+#elif defined(__HAIKU__)
+#include <os/support/ByteOrder.h>
+#define bswap_32 __swap_int32
+#define bswap_16 __swap_int16
 #else
 #include <byteswap.h>
 #endif
@@ -579,6 +583,7 @@ static void brcmsmac_extract(FILE *f, const struct extract *extract,
 	int ucode_rev = 0;
 	int brcmsmac_idx = 0;
 	be32_t size;
+	int size_idx;
 
 
 	brcmsmac_idx = brcmsmac_name_to_idx(extract->name);
@@ -627,7 +632,7 @@ static void brcmsmac_extract(FILE *f, const struct extract *extract,
 	}
 
 	brcmsmac_write_file(brcmsmac_idx, buf, data_length);
-	int size_idx = brcmsmac_name_to_size_idx(extract->name);
+	size_idx = brcmsmac_name_to_size_idx(extract->name);
 	if (size_idx)
 		brcmsmac_write_file(size_idx, (uint8_t *)&size, 4);
 
-- 
2.27.0

