summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2012-07-05 02:50:26 +0200
committerGravatar Nikias Bassen2012-07-05 02:50:26 +0200
commit728d24669d000994c16aee847c441e5ee4466ccd (patch)
tree0514607a093577d53191d078b13e8d1b0a1830d8 /Makefile
parent9a28eef7627b682def960a8ce4d4c19a6222a344 (diff)
downloadlibirecovery-728d24669d000994c16aee847c441e5ee4466ccd.tar.gz
libirecovery-728d24669d000994c16aee847c441e5ee4466ccd.tar.bz2
Makefile: enabled shared lib building
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile66
1 files changed, 22 insertions, 44 deletions
diff --git a/Makefile b/Makefile
index 43ea8d9..cfbb9ab 100644
--- a/Makefile
+++ b/Makefile
@@ -7,69 +7,45 @@ 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
+ LIBS = -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)
+ IRECOVERY_LDFLAGS = $(LDFLAGS)
+ IRECOVERY_LIBS = $(LIBS) -lreadline
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_LDFLAGS = $(LDFLAGS) -dynamiclib
LIBIRECOVERY_SHARED_LIBS = $(LIBS)
else
ifeq ($(UNAME),MINGW32_NT-5.1)
- CFLAGS = -O3 -I include -I c:\mingw\include
- LDFLAGS = -L c:\mingw\lib -L c:\mingw\bin
- LIBS = -lreadline -lusb-1.0 -lsetupapi
+ CFLAGS = -fPIC -O3 -I include -I c:\mingw\include
+ LDFLAGS = -static-libgcc -L c:\mingw\lib -L c:\mingw\bin
+ LIBS = -lusb-1.0 -lsetupapi
IRECOVERY_TARGET = irecovery.exe
- IRECOVERY_OBJECTS = irecovery.o
- IRECOVERY_CFLAGS = $(CFLAGS)
IRECOVERY_LDFLAGS = $(LDFLAGS)
- IRECOVERY_LIBS = $(LIBS) libirecovery.a
+ IRECOVERY_LIBS = $(LIBS) -lreadline
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_LDFLAGS = $(LDFLAGS) -shared
LIBIRECOVERY_SHARED_LIBS = $(LIBS)
else
- CFLAGS = -O3 -I./include -I/usr/include -I/usr/local/include
+ CFLAGS = -fPIC -O3 -I./include -I/usr/include -I/usr/local/include
LDFLAGS = -L/usr/lib -L/usr/local/lib
- LIBS = -lusb-1.0 -lreadline
+ LIBS = -lusb-1.0
IRECOVERY_TARGET = irecovery
- IRECOVERY_OBJECTS = irecovery.o
- IRECOVERY_CFLAGS = $(CFLAGS)
IRECOVERY_LDFLAGS = $(LDFLAGS)
- IRECOVERY_LIBS = $(LIBS)
-
+ IRECOVERY_LIBS = $(LIBS) -lreadline
+
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_LDFLAGS = $(LDFLAGS) -shared -W1,-soname,$(LIBIRECOVERY_SHARED_TARGET)
LIBIRECOVERY_SHARED_LIBS = $(LIBS)
endif
endif
@@ -77,7 +53,7 @@ endif
LIBIRECOVERY_OBJECTS = libirecovery.o
IRECOVERY_OBJECTS = irecovery.o libirecovery.a
-TARGETS = $(LIBIRECOVERY_STATIC_TARGET) $(IRECOVERY_TARGET)
+TARGETS = $(LIBIRECOVERY_SHARED_TARGET) $(LIBIRECOVERY_STATIC_TARGET) $(IRECOVERY_TARGET)
OBJECTS = libirecovery.o irecovery.o
all: $(TARGETS)
@@ -88,13 +64,15 @@ all: $(TARGETS)
%.o: %.c
$(CC) -c $(<) -o $(@) $(CFLAGS)
-$(LIBIRECOVERY_STATIC_TARGET): $(LIBIRECOVERY_STATIC_OBJECTS)
- $(AR) rs $(LIBIRECOVERY_STATIC_TARGET) $(LIBIRECOVERY_STATIC_OBJECTS)
+$(LIBIRECOVERY_STATIC_TARGET): $(LIBIRECOVERY_OBJECTS)
+ $(AR) rs $@ $^
-$(LIBIRECOVERY_SHARED_TARGET): $(LIBIRECOVERY_SHARED_OBJECTS)
+$(LIBIRECOVERY_SHARED_TARGET): $(LIBIRECOVERY_OBJECTS)
+ $(CC) -o $@ $^ $(LIBIRECOVERY_SHARED_LDFLAGS) $(LIBIRECOVERY_SHARED_LIBS)
$(IRECOVERY_TARGET): $(IRECOVERY_OBJECTS)
- $(CC) -o $(IRECOVERY_TARGET) $(IRECOVERY_OBJECTS) $(IRECOVERY_CFLAGS) $(IRECOVERY_LDFLAGS) $(IRECOVERY_LIBS)
+ $(CC) -o $@ $^ $(IRECOVERY_LDFLAGS) $(IRECOVERY_LIBS)
clean:
- $(RM) $(LIBIRECOVERY_STATIC_TARGET) $(IRECOVERY_TARGET) *.o
+ $(RM) $(LIBIRECOVERY_STATIC_TARGET) $(LIBIRECOVERY_SHARED_TARGET) $(IRECOVERY_TARGET) *.o
+