| 1 |
# Installation directories |
|---|
| 2 |
PREFIX ?= /usr/local |
|---|
| 3 |
INCLUDEDIR ?= $(PREFIX)/include |
|---|
| 4 |
LIBDIR ?= $(PREFIX)/lib |
|---|
| 5 |
DATAROOTDIR ?= $(PREFIX)/share |
|---|
| 6 |
MANDIR ?= $(DATAROOTDIR)/man |
|---|
| 7 |
|
|---|
| 8 |
ifeq ($(DEBUG), 1) |
|---|
| 9 |
# if DEBUG is set, then explicitly compile with -O0 |
|---|
| 10 |
AM_CFLAGS ?= -O0 -g3 -gdwarf-2 |
|---|
| 11 |
LDFLAGS ?= -g3 |
|---|
| 12 |
else |
|---|
| 13 |
# if no DEBUG and no CFLAGS are already set, then compile with -O3 |
|---|
| 14 |
CFLAGS ?= -O3 |
|---|
| 15 |
endif |
|---|
| 16 |
|
|---|
| 17 |
AM_CFLAGS += -Wall -Wundef -Wmissing-noreturn -D_GNU_SOURCE -fpic |
|---|
| 18 |
# -Werror -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wswitch -Wshadow -Wcast-align |
|---|
| 19 |
INCLUDEDIRS := -I$(shell pwd)/include |
|---|
| 20 |
LIBDIRS := -L$(shell pwd)/src |
|---|
| 21 |
|
|---|
| 22 |
export PREFIX INCLUDEDIR LIBDIR DATAROOTDIR MANDIR \ |
|---|
| 23 |
AM_CFLAGS LDFLAGS |
|---|
| 24 |
|
|---|
| 25 |
# This library can optionally build bindings for other langugages. |
|---|
| 26 |
# Set these variables to non-empty (either by editing this file or |
|---|
| 27 |
# setting them on the command line) to enable the bindings. |
|---|
| 28 |
# ENABLE_JAVA = 1 |
|---|
| 29 |
|
|---|
| 30 |
ifdef ENABLE_JAVA |
|---|
| 31 |
MAYBE_JAVA = bindings/java |
|---|
| 32 |
endif |
|---|
| 33 |
|
|---|
| 34 |
SUBDIRS = src include $(MAYBE_JAVA) examples man tests |
|---|
| 35 |
ALL_SUBDIRS = src include bindings/java examples man tests |
|---|
| 36 |
|
|---|
| 37 |
C_INDENT_OPTS = -npro -nbad -bap -nbbb -nbbo -nbc -br -bli0 -bls -c40 -cbi0 -cd40 -cdw -ce -ci8 -cli0 -cp40 -ncs -d0 -nbfda -di1 -nfc1 -nfca -i8 -ip0 -l132 -lp -nlps -npcs -pi0 -nprs -npsl -saf -sai -sbi0 -sob -ss -ts8 -ut -T sipc_t |
|---|
| 38 |
|
|---|
| 39 |
all: |
|---|
| 40 |
for i in $(SUBDIRS) ; do \ |
|---|
| 41 |
($(MAKE) -C $$i all) || exit 1;\ |
|---|
| 42 |
done |
|---|
| 43 |
|
|---|
| 44 |
example: |
|---|
| 45 |
$(MAKE) -C examples $@ |
|---|
| 46 |
|
|---|
| 47 |
tests: |
|---|
| 48 |
$(MAKE) -C tests $@ |
|---|
| 49 |
|
|---|
| 50 |
install: |
|---|
| 51 |
for i in $(SUBDIRS) ; do \ |
|---|
| 52 |
($(MAKE) -C $$i install) || exit 1;\ |
|---|
| 53 |
done |
|---|
| 54 |
|
|---|
| 55 |
install-example: |
|---|
| 56 |
$(MAKE) -C examples $@ |
|---|
| 57 |
|
|---|
| 58 |
javadoc: |
|---|
| 59 |
$(MAKE) -C bindings/java $@ |
|---|
| 60 |
|
|---|
| 61 |
indent: |
|---|
| 62 |
find src include tests \ |
|---|
| 63 |
\( -name '*.[ch]' -type f -exec indent $(C_INDENT_OPTS) '{}' \; \) |
|---|
| 64 |
|
|---|
| 65 |
clean: |
|---|
| 66 |
for i in $(ALL_SUBDIRS) ; do \ |
|---|
| 67 |
($(MAKE) -C $$i clean);\ |
|---|
| 68 |
done |
|---|
| 69 |
|
|---|
| 70 |
.PHONY: all example tests install install-example javadoc indent clean |
|---|