summarylogtreecommitdiffstats
path: root/Makefile
blob: b052660c44e56e4a3d20cff75b000e21430f8428 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
CC?=gcc
LD?=gcc
CFLAGS+=-Wall -Os -pedantic -Werror
CSTD?=-std=c99
CSHAREFLAG+=-fpic -fno-stack-protector
INCLUDES?=-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux

LDVER?=$(shell ld -v | cut -d' ' -f1)

ifeq ($(LDVER),GNU)
LDSHAREFLAGS+=-fpic -shared
else
LDSHAREFLAGS+=-lc
endif

PREFIX?=/usr
JARDIR?=$(PREFIX)/share/java/libmatthew-java/
DOCDIR?=$(PREFIX)/share/doc/libmatthew-java/
LIBDIR?=$(PREFIX)/lib/

MATTVER=0.8

DEBUG?=disable

all: libcgi-java.so libunix-java.so

clean:
	rm -f *.o *.so

%.o: %.c %.h
	$(CC) $(CFLAGS) $(CSTD) $(CSHAREFLAG) $(INCLUDES) -c -o $@ $<
lib%.so: %.o
	$(CC) $(LDFLAGS) $(LDSHAREFLAGS) -o $@ $<