11
0
Fork 0

Update the build system

I originally derived the Makefile from one found randomly
on the net. But now, I rewrote it based on the one found in
Asterisk tree.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2009-09-26 16:04:34 +02:00
parent 8c2ece4514
commit df369009fa
2 changed files with 32 additions and 13 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.o
*.o.d
*.so
.*.swp

View File

@ -1,30 +1,48 @@
ASTSRC?=../asterisk
-include $(ASTSRC)/menuselect.makeopts $(ASTSRC)/menuselect.makedeps
LOADABLE_MODS=chan_openbsc
ASTTOPDIR=$(ASTSRC)
INCLUDE=-I$(ASTSRC)/include -I/usr/local/include
# Asterisk configure options
ifneq ($(wildcard $(ASTSRC)/makeopts),)
include $(ASTSRC)/makeopts
endif
ifeq ($(OSARCH),SunOS)
ASTLIBDIR=/opt/asterisk/lib
# Need to replicate some of the Asterisk top makefile logic
# CFLAGS
_ASTCFLAGS:=-I$(ASTTOPDIR)/include $(CONFIG_CFLAGS) $(COPTS)
_ASTLDFLAGS:=$(CONFIG_LDFLAGS) $(LDOPTS)
# Link of shared objects
ifneq ($(findstring darwin,$(OSARCH)),)
_ASTCFLAGS+=-D__Darwin__
SOLINK=-dynamic -bundle -Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace
else
ASTLIBDIR=$(libdir)/asterisk
# These are used for all but Darwin
SOLINK=-shared
ifneq ($(findstring BSD,$(OSARCH)),)
_ASTLDFLAGS+=-L/usr/local/lib
endif
endif
MODULES_DIR=$(ASTLIBDIR)/modules
ifeq ($(OSARCH),SunOS)
SOLINK=-shared -fpic -L/usr/local/ssl/lib -lrt
endif
ifeq ($(OSARCH),OpenBSD)
SOLINK=-shared -fpic
endif
# Menuselect stuff
-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
# Modules rules
MODULE_PREFIX=chan
MENUSELECT_CATEGORY=CHANNELS
MENUSELECT_DESCRIPTION=Channel Drivers
all: _all
include $(ASTTOPDIR)/Makefile.moddir_rules
%.so: %.o
$(CC) -shared -o $@ $<
%.o: %.c
$(CC) -fPIC $(INCLUDE) -DAST_MODULE=\"$*\" -o $@ -c $<