diff options
author | Nikias Bassen | 2012-07-05 03:52:29 +0200 |
---|---|---|
committer | Nikias Bassen | 2012-07-05 03:52:29 +0200 |
commit | 8123786ff4209cc2849bf0d14cd2f4b3e762883e (patch) | |
tree | 7ad1480777a6ea62f484cc155ee25f79ae7e85ea /Makefile | |
parent | a047c7f2779cb9d6ae68b281f5d74e835c045ba6 (diff) | |
download | libirecovery-8123786ff4209cc2849bf0d14cd2f4b3e762883e.tar.gz libirecovery-8123786ff4209cc2849bf0d14cd2f4b3e762883e.tar.bz2 |
Makefile: better system/compiler detection
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 98 |
1 files changed, 52 insertions, 46 deletions
@@ -1,53 +1,59 @@ -AR := ar -CP := cp -CC := gcc +MACHINE := $(shell $(CC) -dumpmachine) -UNAME := $(shell uname -s) +ifeq ($(findstring darwin,$(MACHINE)), darwin) + CFLAGS = -I./include -I/usr/local/include -I/opt/local/include + LDFLAGS = -L/usr/lib -L/opt/local/lib + LIBS = -lusb-1.0 -framework CoreFoundation -framework IOKit -ifeq ($(UNAME),Darwin) - CFLAGS = -I./include -I/usr/local/include -I/opt/local/include - LDFLAGS = -L/usr/lib -L/opt/local/lib - LIBS = -lusb-1.0 -framework CoreFoundation -framework IOKit - - IRECOVERY_TARGET = irecovery - IRECOVERY_LDFLAGS = $(LDFLAGS) - IRECOVERY_LIBS = $(LIBS) -lreadline - - LIBIRECOVERY_STATIC_TARGET = libirecovery.a - - LIBIRECOVERY_SHARED_TARGET = libirecovery.dylib - 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 = -static-libgcc -L c:\mingw\lib -L c:\mingw\bin - LIBS = -lkernel32 -lmsvcrt -lsetupapi - - IRECOVERY_TARGET = irecovery.exe - IRECOVERY_LDFLAGS = $(LDFLAGS) - IRECOVERY_LIBS = $(LIBS) -lreadline - - LIBIRECOVERY_STATIC_TARGET = libirecovery.a - - LIBIRECOVERY_SHARED_TARGET = libirecovery.dll - LIBIRECOVERY_SHARED_LDFLAGS = $(LDFLAGS) -shared - LIBIRECOVERY_SHARED_LIBS = $(LIBS) - else - CFLAGS = -fPIC -O3 -I./include -I/usr/include -I/usr/local/include - LDFLAGS = -L/usr/lib -L/usr/local/lib - LIBS = -lusb-1.0 - - IRECOVERY_TARGET = irecovery - IRECOVERY_LDFLAGS = $(LDFLAGS) - IRECOVERY_LIBS = $(LIBS) -lreadline + IRECOVERY_TARGET = irecovery + IRECOVERY_LDFLAGS = $(LDFLAGS) + IRECOVERY_LIBS = $(LIBS) -lreadline + + LIBIRECOVERY_STATIC_TARGET = libirecovery.a + + LIBIRECOVERY_SHARED_TARGET = libirecovery.dylib + LIBIRECOVERY_SHARED_LDFLAGS = $(LDFLAGS) -dynamiclib + LIBIRECOVERY_SHARED_LIBS = $(LIBS) +endif - LIBIRECOVERY_STATIC_TARGET = libirecovery.a +ifeq ($(findstring linux,$(MACHINE)), linux) + CFLAGS = -fPIC -O3 -I./include -I/usr/include -I/usr/local/include + LDFLAGS = -L/usr/lib -L/usr/local/lib + LIBS = -lusb-1.0 - LIBIRECOVERY_SHARED_TARGET = libirecovery.so - LIBIRECOVERY_SHARED_LDFLAGS = $(LDFLAGS) -shared -W1,-soname,$(LIBIRECOVERY_SHARED_TARGET) - LIBIRECOVERY_SHARED_LIBS = $(LIBS) - endif + IRECOVERY_TARGET = irecovery + IRECOVERY_LDFLAGS = $(LDFLAGS) + IRECOVERY_LIBS = $(LIBS) -lreadline + + LIBIRECOVERY_STATIC_TARGET = libirecovery.a + + LIBIRECOVERY_SHARED_TARGET = libirecovery.so + LIBIRECOVERY_SHARED_LDFLAGS = $(LDFLAGS) -shared -W1,-soname,$(LIBIRECOVERY_SHARED_TARGET) + LIBIRECOVERY_SHARED_LIBS = $(LIBS) +endif + +WIN32= +ifeq ($(findstring cygwin,$(MACHINE)), cygwin) + WIN32=1 + CC=gcc-3 +endif +ifeq ($(findstring mingw32,$(MACHINE)), mingw32) + WIN32=1 +endif +ifdef WIN32 + CFLAGS = -O3 -DWIN32 -I include -I c:\mingw\include + LDFLAGS = -static-libgcc -L c:\mingw\lib -L c:\mingw\bin + LIBS = -lkernel32 -lmsvcrt -lsetupapi + + IRECOVERY_TARGET = irecovery.exe + IRECOVERY_LDFLAGS = $(LDFLAGS) + IRECOVERY_LIBS = $(LIBS) -lreadline + + LIBIRECOVERY_STATIC_TARGET = libirecovery.a + + LIBIRECOVERY_SHARED_TARGET = libirecovery.dll + LIBIRECOVERY_SHARED_LDFLAGS = $(LDFLAGS) -shared + LIBIRECOVERY_SHARED_LIBS = $(LIBS) endif LIBIRECOVERY_OBJECTS = libirecovery.o |