48 lines
1.0 KiB
Plaintext
48 lines
1.0 KiB
Plaintext
OUT = aseawk
|
|
|
|
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
|
|
CFLAGS = -Wall -O2 -D_REENTRANT -D_THREAD_SAFE -fPIC -I../.. $(JNI_INCPATH)
|
|
LDFLAGS =
|
|
LIBS =
|
|
|
|
JAVAC = javac
|
|
JAVACFLAGS = -classpath ../..
|
|
|
|
all: lib jni
|
|
|
|
lib: $(C_OBJS)
|
|
$(AR) cr lib$(OUT).a $(C_OBJS)
|
|
|
|
jni: lib $(JNI_OBJS) $(JAVA_OBJS)
|
|
$(CC) -shared -o $(OUT)_jni.so $(JNI_OBJS) -lm -L. -l$(OUT)
|
|
|
|
#$(CC) -fPIC -shared -static-libgcc -o $(OUT)_jni.so -L. -laseawk -lm libaseawk.a jni.o
|
|
#$(LD) -fPIC -shared -soname lib$(OUT).so -o $(OUT)_jni.so -L . -l aseawk jni.o
|
|
|
|
clean:
|
|
rm -rf $(C_OBJS) $(JNI_OBJS) $(JAVA_OBJS) lib$(OUT).a lib$(OUT).so *.o
|
|
|
|
.SUFFIXES: .c .o .java .class
|
|
.c.o:
|
|
$(CC) $(CFLAGS) -c $<
|
|
|
|
.java.class:
|
|
$(JAVAC) $(JAVACFLAGS) $<
|
|
|