aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2009-09-26 16:04:34 +0200
committerSylvain Munaut <tnt@246tNt.com>2009-09-26 23:13:21 +0200
commitdf369009fa00d9cc2f7fa359652d982d52fd212f (patch)
tree587021b7a6ba62c269d172917b70b58d38f0369a
parent8c2ece4514e602a5c66f98eb2b12556b22b48d61 (diff)
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>
-rw-r--r--.gitignore1
-rw-r--r--Makefile44
2 files changed, 32 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 794e7a1..9054226 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
*.o
+*.o.d
*.so
.*.swp
diff --git a/Makefile b/Makefile
index eaa8a29..db62557 100644
--- a/Makefile
+++ b/Makefile
@@ -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
+
+ifeq ($(OSARCH),SunOS)
+ SOLINK=-shared -fpic -L/usr/local/ssl/lib -lrt
endif
-MODULES_DIR=$(ASTLIBDIR)/modules
+
+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 $<