Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Modify makefile so it compiles on Macintosh

  • Loading branch information...
commit de7bbaa3802cd0e04f9304cc5694060c150ce62d 1 parent 363d1de
@pjlegato authored
Showing with 58 additions and 13 deletions.
  1. +5 −0 .gitignore
  2. +51 −13 Makefile
  3. +2 −0  README
View
5 .gitignore
@@ -0,0 +1,5 @@
+*.class
+*.dll
+CurlGlue.*
+*.jnilib
+*.o
View
64 Makefile
@@ -1,3 +1,29 @@
+LDFLAGS = -shared -Wl,--add-stdcall-alias
+
+
+#
+# Platform-specific stuff. Note that the Windows stuff is untested as I don't have a Windows machine.
+#
+
+UNAME := $(shell uname)
+
+ifeq ($(UNAME), Darwin)
+
+# Assumes DarwinPorts directory structure
+LIB_DIR=/opt/local/lib/
+CURL_H=/opt/local/include/curl/curl.h
+CURLVER_H=/opt/local/include/curl/curlver.h
+
+
+LDFLAGS = -L$(LIB_DIR) -lssl -lcrypto -lcurl -framework JavaVM -dynamiclib
+CFLAGS = -c -I/System/Library/Frameworks/JavaVM.framework/Headers
+CPPFLAGS = -I$(JAVA_HOME)/include
+TARGET = libjavacurl.jnilib
+endif
+
+###################
+
+ifeq ($(UNAME), Windows) # someone who actually has a Windows system, please change this to the real uname value
# Note: this makefile has been tested with MingW32 gcc
# under Windows XP using Curl 7.17.1 and OpenSSL 0.9.8g
@@ -10,17 +36,34 @@ endif
ifndef OPENSSL_PATH
OPENSSL_PATH = ../../sdks/openssl_mingw32-0.9.8g
endif
-
TARGET = javacurl.dll
+
+CURL_H=$(LIBCURL_PATH)/include/curl/curl.h
+CURLVER_H=$(LIBCURL_PATH)/include/curl/curlver.h
+
+CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/win32
+LDFLAGS = -lwsock32 -lwinmm
+LDFLAGS += -lcurldll -lzdll
+LDFLAGS += -L$(OPENSSL_PATH)/out
+LDFLAGS += -L$(LIBCURL_PATH)/lib
+LDFLAGS += -L$(ZLIB_PATH)
+LDFLAGS += -lssl32 -leay32
+CFLAGS = -c
+
+endif
+
+###################
+#
+# End platform-specific stuff
+#
+
OBJS = javacurl.o
CC = gcc
-CFLAGS = -c
PERL = perl
# Note: with JDK1.3 you might have to replace "__int64" in jni_md.h by "signed long"
# if you are encountering any compilation problem
#CPPFLAGS = -ID:/jdk/include -ID:/jdk/include/win32 -I./include
-CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/win32
CPPFLAGS += -I$(LIBCURL_PATH)/include
# Note: the libraries used below are for libcurl with SSL. You will probably need to
@@ -29,15 +72,10 @@ CPPFLAGS += -I$(LIBCURL_PATH)/include
# at link time
#LDFLAGS = -v -shared -Wl,--add-stdcall-alias -L. -lcurl -lssl -lcrypto
#LDFLAGS = -shared -Wl,--add-stdcall-alias -L$(LIBCURL_PATH)/lib -lcurl -lssl -lcrypto
-LDFLAGS = -shared -Wl,--add-stdcall-alias
-LDFLAGS += -L$(OPENSSL_PATH)/out
-LDFLAGS += -L$(LIBCURL_PATH)/lib
-LDFLAGS += -L$(ZLIB_PATH)
-LDFLAGS += -lwsock32 -lwinmm
+#LDFLAGS = -shared -Wl,--add-stdcall-alias
#LDFLAGS += -lcurl -lz
-LDFLAGS += -lcurldll -lzdll
-#LDFLAGS += -lssl -lcrypto
-LDFLAGS += -lssl32 -leay32
+
+
all: $(TARGET) test.class
@@ -60,14 +98,14 @@ test.class: test.java CurlGlue.class $(TARGET)
CurlGlue.class: CurlGlue.java
javac $<
-CurlGlue.java: $(LIBCURL_PATH)/include/curl/curl.h $(LIBCURL_PATH)/include/curl/curlver.h
+CurlGlue.java: $(CURL_H) $(CURLVER_H)
$(PERL) define2java.pl $^ > $@
$(TARGET): $(OBJS)
$(CC) -o $(TARGET) $(OBJS) $(LDFLAGS)
clean:
- $(RM) javacurl.dll javacurl.o CurlGlue.h CurlGlue.class CurlWrite.class
+ $(RM) $(TARGET) javacurl.o CurlGlue.h CurlGlue.class CurlWrite.class
testclean:
$(RM) test.class *.log
View
2  README
@@ -15,3 +15,5 @@ stuff supported.
Feel free to grab the source files in here and help out!
The 'test.java' is the actual program that uses the curl stuff.
+
+* Makefile updated March 2010 to compile on Macintosh by Paul Legato (pjlegato at gmail dot com)
Please sign in to comment.
Something went wrong with that request. Please try again.