summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Joshua Hill2010-11-06 18:09:53 -0400
committerGravatar Joshua Hill2010-11-06 18:09:53 -0400
commitd82a73f1180a5f201397b92e6f6db33411cbe686 (patch)
treebcc7c4ba2e103770f905972854392d8c3e448f16 /Makefile
parente89c9418e7072d5a1491055c8f78748bf82de49c (diff)
downloadlibirecovery-d82a73f1180a5f201397b92e6f6db33411cbe686.tar.gz
libirecovery-d82a73f1180a5f201397b92e6f6db33411cbe686.tar.bz2
updated libirecovery to the latest version from greenpois0n. it at least compiles on osx now, I need to test on other systems
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile132
1 files changed, 98 insertions, 34 deletions
diff --git a/Makefile b/Makefile
index b7f3522..941dfdd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,37 +1,101 @@
-all: linux
- @echo "Please choose either macosx, linux, or windows"
-
-static:
- gcc -o libirecovery.o -c src/libirecovery.c -g -I./include
- ar rs libirecovery.a libirecovery.o
- gcc -o irecovery src/irecovery.c -g -I./include -L. -lirecovery -lreadline -lusb-1.0
-
-linux:
- gcc -o libirecovery.o -c src/libirecovery.c -g -I./include -lreadline -fPIC
- gcc -o libirecovery.so libirecovery.o -g -shared -Wl,-soname,libirecovery.so -lusb-1.0
- gcc -o irecovery src/irecovery.c -g -I./include -L. -lirecovery -lreadline
-
-macosx:
- gcc -o libirecovery.dylib -c src/libirecovery.c -dynamiclib
- gcc -o irecovery src/irecovery.c -I./include -L. -lirecovery -lreadline -lusb-1.0
-
-windows:
- gcc -o libirecovery.dll -c src/libirecovery.c -I. -lusb-1.0 -lreadline -shared -fPIC
- gcc -o irecovery irecovery.c -I. -lirecovery -lreadline
-
-install:
- cp libirecovery.so /usr/local/lib/libirecovery.so
- cp include/libirecovery.h /usr/local/include/libirecovery.h
- cp irecovery /usr/local/bin/irecovery
- ldconfig
-
-uninstall:
- rm -rf /usr/local/lib/libirecovery.so
- rm -rf /usr/local/include/libirecovery.h
- rm -rf /usr/local/bin/irecovery
-
-clean:
- rm -rf irecovery libirecovery.o libirecovery.so libirecovery.a
+AR := ar
+CP := cp
+CC := gcc
+
+UNAME := $(shell uname -s)
+
+ifeq ($(UNAME),Darwin)
+ CFLAGS = -I./include -I/usr/local/include -I/opt/local/include
+ LDFLAGS = -L/usr/lib -L/opt/local/lib
+ LIBS = -lreadline -lusb-1.0 -framework CoreFoundation -framework IOKit
+
+ IRECOVERY_TARGET = irecovery
+ IRECOVERY_OBJECTS = irecovery.o libirecovery.a
+ IRECOVERY_CFLAGS = $(CFLAGS)
+ IRECOVERY_LDFLAGS = $(LDFLAGS)
+ IRECOVERY_LIBS = $(LIBS)
+
+ LIBIRECOVERY_STATIC_TARGET = libirecovery.a
+ LIBIRECOVERY_STATIC_OBJECTS = libirecovery.o
+ LIBIRECOVERY_STATIC_CFLAGS = $(CFLAGS)
+ LIBIRECOVERY_STATIC_LDFLAGS = $(LDFLAGS)
+ LIBIRECOVERY_STATIC_LIBS = $(LIBS)
+
+ LIBIRECOVERY_SHARED_TARGET = libirecovery.dylib
+ LIBIRECOVERY_SHARED_OBJECTS = libirecovery.o
+ LIBIRECOVERY_SHARED_CFLAGS = $(CFLAGS)
+ LIBIRECOVERY_SHARED_LDFLAGS = $(LDFLAGS)
+ LIBIRECOVERY_SHARED_LIBS = $(LIBS)
+else
+ ifeq ($(UNAME),MINGW32_NT-5.1)
+ CFLAGS = -O3 -I include -I c:\mingw\include
+ LDFLAGS = -L c:\mingw\lib -lreadline
+ LIBS = -lreadline -lusb-1.0 -framework CoreFoundation -framework IOKit
+
+ IRECOVERY_TARGET = irecovery.exe
+ IRECOVERY_OBJECTS = irecovery.o
+ IRECOVERY_CFLAGS = $(CFLAGS)
+ IRECOVERY_LDFLAGS = $(LDFLAGS)
+ IRECOVERY_LIBS = $(LIBS) libirecovery.a
+
+ LIBIRECOVERY_STATIC_TARGET = libirecovery.a
+ LIBIRECOVERY_STATIC_OBJECTS = libirecovery.o
+ LIBIRECOVERY_STATIC_CFLAGS = $(CFLAGS)
+ LIBIRECOVERY_STATIC_LDFLAGS = $(LDFLAGS)
+ LIBIRECOVERY_STATIC_LIBS = $(LIBS)
+
+ LIBIRECOVERY_SHARED_TARGET = libirecovery.dll
+ LIBIRECOVERY_SHARED_OBJECTS = libirecovery.o
+ LIBIRECOVERY_SHARED_CFLAGS = $(CFLAGS)
+ LIBIRECOVERY_SHARED_LDFLAGS = $(LDFLAGS)
+ LIBIRECOVERY_SHARED_LIBS = $(LIBS)
+ else
+ CFLAGS = -O3 -I./include -I/usr/include -I/usr/local/include
+ LDFLAGS = -L/usr/lib -L/usr/local/lib
+ LIBS = -lusb-1.0 -lreadline
+ IRECOVERY_TARGET = irecovery
+ IRECOVERY_OBJECTS = irecovery.o
+ IRECOVERY_CFLAGS = $(CFLAGS)
+ IRECOVERY_LDFLAGS = $(LDFLAGS)
+ IRECOVERY_LIBS = $(LIBS)
+
+ LIBIRECOVERY_STATIC_TARGET = libirecovery.a
+ LIBIRECOVERY_STATIC_OBJECTS = libirecovery.o
+ LIBIRECOVERY_STATIC_CFLAGS = $(CLFAGS)
+ LIBIRECOVERY_STATIC_LDFLAGS = $(LDFLAGS)
+ LIBIRECOVERY_STATIC_LIBS = $(LIBS)
+
+ LIBIRECOVERY_SHARED_TARGET = libirecovery.so
+ LIBIRECOVERY_SHARED_OBJECTS = libirecovery.o
+ LIBIRECOVERY_SHARED_CFLAGS = $(CFLAGS)
+ LIBIRECOVERY_SHARED_LDFLAGS = $(LDFLAGS)
+ LIBIRECOVERY_SHARED_LIBS = $(LIBS)
+ endif
+endif
+
+LIBIRECOVERY_OBJECTS = libirecovery.o
+IRECOVERY_OBJECTS = irecovery.o libirecovery.a
+
+TARGETS = $(LIBIRECOVERY_STATIC_TARGET) $(IRECOVERY_TARGET)
+OBJECTS = libirecovery.o irecovery.o
+
+%.o: %.S
+ $(CC) -c $(<) -o $(@) $(CFLAGS)
+
+%.o: %.c
+ $(CC) -c $(<) -o $(@) $(CFLAGS)
+$(LIBIRECOVERY_STATIC_TARGET): $(LIBIRECOVERY_STATIC_OBJECTS)
+ $(AR) rs $(LIBIRECOVERY_STATIC_TARGET) $(LIBIRECOVERY_STATIC_OBJECTS)
+
+$(LIBIRECOVERY_SHARED_TARGET): $(LIBIRECOVERY_SHARED_OBJECTS)
+
+$(IRECOVERY_TARGET): $(IRECOVERY_OBJECTS)
+ $(CC) -o $(IRECOVERY_TARGET) $(IRECOVERY_OBJECTS) $(IRECOVERY_CFLAGS) $(IRECOVERY_LDFLAGS) $(IRECOVERY_LIBS)
+
+all: $(TARGETS)
+
+clean:
+ $(RM) $(LIBIRECOVERY_STATIC_TARGET) $(IRECOVERY_TARGET) *.o \ No newline at end of file