2007-01-18 14:34:18 +00:00
|
|
|
OUT = aseawk
|
2007-01-18 08:54:05 +00:00
|
|
|
|
|
|
|
C_SRCS = awk.c err.c tree.c str.c tab.c map.c parse.c \
|
|
|
|
run.c rec.c val.c func.c misc.c extio.c rex.c
|
|
|
|
JNI_SRCS = jni.c
|
|
|
|
JAVA_SRCS = Exception.java Extio.java Awk.java StdAwk.java
|
|
|
|
|
|
|
|
C_OBJS = $(C_SRCS:.c=.o)
|
|
|
|
JNI_OBJS = $(JNI_SRCS:.c=.o)
|
|
|
|
JAVA_OBJS = $(JAVA_SRCS:.java=.class)
|
|
|
|
|
|
|
|
JNI_INCPATH= \
|
|
|
|
-I"$(JAVA_HOME)/include" \
|
|
|
|
-I"$(JAVA_HOME)/include/linux"
|
|
|
|
|
|
|
|
CC = gcc
|
|
|
|
AR = ar
|
|
|
|
LD = ld
|
|
|
|
RANLIB = ranlib
|
2007-01-18 14:34:18 +00:00
|
|
|
CFLAGS = -Wall -O2 -D_REENTRANT -D_THREAD_SAFE -fPIC -fno-omit-frame-pointer -fno-strict-aliasing -I../.. $(JNI_INCPATH)
|
2007-01-18 08:54:05 +00:00
|
|
|
LDFLAGS =
|
|
|
|
LIBS =
|
|
|
|
|
|
|
|
JAVAC = javac
|
|
|
|
JAVACFLAGS = -classpath ../..
|
|
|
|
|
|
|
|
all: lib jni
|
|
|
|
|
|
|
|
lib: $(C_OBJS)
|
2007-01-18 14:34:18 +00:00
|
|
|
$(AR) cr lib$(OUT).a $(C_OBJS)
|
2007-01-18 08:54:05 +00:00
|
|
|
|
|
|
|
jni: lib $(JNI_OBJS) $(JAVA_OBJS)
|
2007-01-18 14:34:18 +00:00
|
|
|
$(CC) -shared -o lib$(OUT)_jni.so $(JNI_OBJS) -lm -L. -l$(OUT)
|
|
|
|
|
|
|
|
#$(CC) -fPIC -shared -static-libgcc -o lib$(OUT)_jni.so -L. -laseawk -lm libaseawk.a jni.o
|
|
|
|
#$(LD) -fPIC -shared -soname lib$(OUT).so -o lib$(OUT).so -L . -l aseawk jni.o
|
2007-01-18 08:54:05 +00:00
|
|
|
|
|
|
|
clean:
|
2007-01-18 14:34:18 +00:00
|
|
|
rm -rf $(C_OBJS) $(JNI_OBJS) $(JAVA_OBJS) lib$(OUT).a lib$(OUT).so *.o
|
2007-01-18 08:54:05 +00:00
|
|
|
|
|
|
|
.SUFFIXES: .c .o .java .class
|
|
|
|
.c.o:
|
|
|
|
$(CC) $(CFLAGS) -c $<
|
|
|
|
|
|
|
|
.java.class:
|
|
|
|
$(JAVAC) $(JAVACFLAGS) $<
|
|
|
|
|