1# 2# Makefile 3# 4# An example of the "C" interface to OPAL 5# 6# Open Phone Abstraction Library 7# 8# Copyright (c) 2008 Vox Lucida 9# 10# The contents of this file are subject to the Mozilla Public License 11# Version 1.0 (the "License"); you may not use this file except in 12# compliance with the License. You may obtain a copy of the License at 13# http://www.mozilla.org/MPL/ 14# 15# Software distributed under the License is distributed on an "AS IS" 16# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 17# the License for the specific language governing rights and limitations 18# under the License. 19# 20# The Original Code is Open Phone Abstraction Library. 21# 22# The Initial Developer of the Original Code is Vox Lucida (Robert Jongbloed) 23# 24# Contributor(s): ______________________________________. 25# 26# $Revision$ 27# $Author$ 28# $Date$ 29 30PROG = c_api 31SOURCES := main.c 32 33 34# If we have environment variables for local copies of 35# OPAL and PTLib then use those packages by overriding 36# the search path for pkg-config 37ifneq ($(PTLIBDIR),) 38ifneq ($(OPALDIR),) 39PKG_CONFIG_PATH=$(OPALDIR):$(PTLIBDIR) 40endif 41endif 42 43 44# Get required flags from library 45 46CFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config $(PKG_FLAGS) --cflags opal) 47LDFLAGS += -ldl $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config $(PKG_FLAGS) --libs opal) 48 49 50OBJDIR := obj 51 52vpath %.o $(OBJDIR) 53 54$(OBJDIR)/%.o : %.c 55 @mkdir -p $(OBJDIR) >/dev/null 2>&1 56 $(CC) $(CFLAGS) -c $< -o $@ 57 58$(OPAL_DEPDIR)/%.dep : %.cxx 59 @if [ ! -d $(OPAL_DEPDIR) ] ; then mkdir -p $(OPAL_DEPDIR) ; fi 60 @printf %s $(OPAL_OBJDIR)/ > $@ 61 $(CC) $(CFLAGS:-g=) -M $< >> $@ 62 63 64# This builds the application 65 66OBJECTS = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(patsubst %.cxx,%.o,$(notdir $(SOURCES))))) 67 68$(OBJDIR)/$(PROG): $(OBJECTS) 69 $(CC) $^ $(LDFLAGS) -o $@ 70 71depend: 72 73clean: 74 rm $(OBJECTS) $(OBJDIR)/$(PROG) 75