blob: 9fc0b12a420ea6c01f9aef6088bbf5b41126a0d2 [file] [log] [blame]
Remove unneeded CFLAGS & LDFLAGS
Use pkg-config to locate CFLAGS & LDFLAGS for libftdi1
Add include of unistd for file descriptor functions (open,read,write,close)
Patch by Todd Broch
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,10 @@
-CFLAGS = -Wall -O2 -s -Werror
-LDFLAGS = -lusb -lftdi -s
+PKG_CONFIG?=pkg-config
+LIBFTDI_CFLAGS := $(shell $(PKG_CONFIG) --cflags libftdi1)
+LIBFTDI_LDLIBS := $(shell $(PKG_CONFIG) --libs libftdi1)
+
+CFLAGS += -Wall $(LIBFTDI_CFLAGS)
+LDFLAGS += $(LIBFTDI_LDLIBS)
+
PROG = ftx_prog
all: $(PROG)
--- a/ftx_prog.c
+++ b/ftx_prog.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>