all: Compile globally without _GNU_SOURCE, define _BSD_SOURCE or _GNU_SOURCE where needed

This commit is contained in:
Pali Rohár committed 2016-12-06 23:10:58 +01:00
1 parent 676da47751
commit 5e79d651ca
4 files changed
+17 -1

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@ CC = gcc
CROSS_CC = $(CROSS_COMPILE)$(CC) CROSS_CC = $(CROSS_COMPILE)$(CC)
HOST_CC = $(HOST_COMPILE)$(CC) HOST_CC = $(HOST_COMPILE)$(CC)
CPPFLAGS += -DVERSION=\"$(VERSION)\" -DBUILD_DATE="\"$(BUILD_DATE)\"" -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L CPPFLAGS += -DVERSION=\"$(VERSION)\" -DBUILD_DATE="\"$(BUILD_DATE)\"" -D_POSIX_C_SOURCE=200809L
CFLAGS += -W -Wall -O2 -pedantic -std=c99 CFLAGS += -W -Wall -O2 -pedantic -std=c99
LIBS += -lusb LIBS += -lusb
+6
View File
@@ -20,6 +20,12 @@
/* This is simple CAL parser form Calvaria */ /* This is simple CAL parser form Calvaria */
#ifdef __linux__
#ifndef _BSD_SOURCE
#define _BSD_SOURCE
#endif
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
+6
View File
@@ -16,6 +16,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef __linux__
#ifndef _BSD_SOURCE
#define _BSD_SOURCE
#endif
#endif
#include <fcntl.h> #include <fcntl.h>
#include <libgen.h> #include <libgen.h>
#include <unistd.h> #include <unistd.h>
+4
View File
@@ -21,7 +21,11 @@
/* usage: sudo USBSNIFF_WAIT=1 LD_PRELOAD=./libusb-sniff.so flasher-3.5 ... */ /* usage: sudo USBSNIFF_WAIT=1 LD_PRELOAD=./libusb-sniff.so flasher-3.5 ... */
/* usage: sudo USBSNIFF_SKIP_READ=1 USBSNIFF_SKIP_WRITE=1 LD_PRELOAD=./libusb-sniff.so flasher-3.5 ... */ /* usage: sudo USBSNIFF_SKIP_READ=1 USBSNIFF_SKIP_WRITE=1 LD_PRELOAD=./libusb-sniff.so flasher-3.5 ... */
/* Enable RTLD_NEXT for glibc */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE #define _GNU_SOURCE
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>