⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makefile

📁 h.248协议源码
💻
字号:
# RADVision Master Makefile
# Note: This makefile must be run with GNU make version 3.78 or higher.
# The following parameters are supported.  
# Generic parameters:
#	TYPE= { debug, release }
#	TARGET_OS= { solaris, vxworks, psos, win32, redhat, ose, nucleus, tru64 }
# 	HOST_OS= { solaris, redhat, win32, tru64 }
#	TARGET_FAMILY= { ...target cpu family used for identify specific tools... }
#	TARGET_CPU= { ...target cpu definition for libraries and includes... }
#	COMPILER_CPU=  { ...compiler specific cpu type... }
#	COMPILER= { sparcworks, gnu, diab, ghs }
#	CFLAGS= { additional compiler options that may be needed }
#	INSTALL_ROOT= { ...path to install include files, libraries, and demos... }
# MGCP Specific parameters:
#	RV_MGCP_NCS := 1
#       RV_MGCP_NO_RESPACK := 1
#	RV_SNMP := 1
# For example:
# make TARGET_OS=psos TYPE=RELEASE HOST_OS=win32 COMPILER=diab COMPILER_CPU=PPC603ES RV_SNMP=1 libs
# Builds a release version (default) of the all the libraries for pSOS using the diab
# compiler for the PPC603 CPU (the ES indicates elf format with software floating point)
# and turning on SNMP support. It also indicates that this is being done on a win32 machine.
# Note that the pSOS tools only use the COMPILER_CPU flag to identify the target. For
# specific settings for other tools, see the readme file or the OS.mak (OS=TARGET_OS) file
# for more information.
#
# To make things easier, all of these paramaters may be set in the default.mak file
# instead of having to specifiy them on the make command line.

SHELL = /bin/sh

# All projects makes - include full path to each project makefile (.mak is assumed)
PROJECTS := core/core epp/epp mgcp/mgcp sdp/sdp rtp/rtp mgcp/client/mg2/mg2 \
	mgcp/server/mgc/mgc snmpagents/sunsubagent/sunsubagent \
	megaco/megaco megaco/client/megacomg/megacomg \
	megaco/server/megacomgc/megacomgc rvrtp/rvrtp rvrtp/demo/rvrtpdemo \
	rvrtp/benchmark/rvrtpbenchmark rvrtp/compatability/rtp_c \
	rvrtp/compatability/compatabilityTest/compatabilityTest

# If there is a defaults file, load it. If not, don't worry about it.
-include default.mak

# List of supported options. Options for COMPILER are checked
# in the appropriate TARGET_OS.mak file. Values for TARGET_FAMILY,
# TARGET_CPU, and COMPILER_CPU may be checked by the TARGET_OS.mak
# files or may simply be sent to, and checked (hopefully) by the
# compiler.
LEGAL_TYPES:= debug release
LEGAL_TARGETOS:= solaris vxworks psos win32 redhat ose nucleus tru64
LEGAL_HOSTOS:= solaris win32 redhat tru64

# Check to make sure required parameters are set to legal values
ifndef TYPE
$(error TYPE must be set in the default.mak, environment, or on the command line)
endif
ifneq ($(TYPE), $(findstring $(TYPE),$(LEGAL_TYPES)))
$(error "$(findstring $(TYPE),$(LEGAL_TYPES))" The TYPE "$(TYPE)" is not supported. Legal values are: $(LEGAL_TYPES))
endif
ifndef TARGET_OS
$(error TARGET_OS must be set in the default.mak, environment, or on the command line)
endif
ifneq ($(TARGET_OS), $(findstring $(TARGET_OS),$(LEGAL_TARGETOS)))
$(error The TARGET_OS "$(TARGET_OS)" is not supported. Legal values are: $(LEGAL_TARGETOS))
endif
ifndef HOST_OS
$(error HOST_OS must be set in the default.mak, environment, or on the command line)
endif
ifneq ($(HOST_OS), $(findstring $(HOST_OS),$(LEGAL_HOSTOS)))
$(error The HOST_OS "$(HOST_OS)" is not supported. Legal values are: $(LEGAL_HOSTOS))
endif

# Just check to make sure COMPILER is set to something
ifndef COMPILER
$(error COMPILER must be set in the default.mak, environment, or on the command line)
endif

# If goal is install, make sure INSTALL_ROOT is set
ifeq (install, $(findstring install,$(MAKECMDGOALS)))
ifndef INSTALL_ROOT
$(error INSTALL_ROOT must be set in the default.mak, environment, or on the command line)
endif
endif

# Global Makefile and sub-make list - used for dependencies - generated
MAKE_LIST := Makefile

# List of external include directories - generated
INCLUDE_DIRS := 

# List of external libraries - generated
LIBS_LIST :=

# List of directories to look for libraries in - generated (start with main directory)
LIB_DIRS := .

#  List of source file drectories - for includes - generated
SOURCE_DIRS :=

# List of source files - generated
SOURCE_LIST :=

# List of targets to make for libs target - generated
LIBS_TARGET_LIST :=

# List of targets to make in addition to libs for all target - generated
OTHER_TARGET_LIST :=

# List of include files to be copied into install directory - generated
INCLUDE_INSTALL_LIST :=

# List of demo files to be copied into install directory - generated
DEMO_INSTALL_LIST :=

# default make just prints out message
.PHONY: default
default:
	@echo "No target indicated. Please indicate target to build (ie 'make libs')."

# Stuff to save make some time
Makefile: ;
%.mak: ;
%.c: ;
%.h: ;

# load OS and Compiler specific definitions
include $(TARGET_OS).mak

# Include all the projects
-include $(PROJECTS:%=%.mak)

# check for optional modules
ifdef RV_MGCP_NCS
CFLAGS += -DRV_MGCP_NCS
endif
ifdef RV_MGCP_NO_RESPACK
CFLAGS += -DRV_MGCP_NO_RESPACK
endif
ifdef RV_SNMP
CFLAGS += -DRV_SNMP
endif

# Set up compiler and linker flags for debug or optimization
ifeq ($(TYPE), debug)
CFLAGS += $(C_DEBUGFLAG) -DRV_DEBUG_ON
else
CFLAGS += $(C_OPTFLAG)
endif

# Add OS/Tools specific include and library directories and libraries
CFLAGS += $(INCLUDE_DIRS:%=$(INCLUDE_FLAG)%)
LDFLAGS += $(LIB_DIRS:%=$(LIBS_DIRFLAG)%) $(LIBS_LIST:%=$(LIBS_FLAG)%)

# Save base CFLAGS info for creating stand-alone scripts
SCRIPT_CFLAGS := $(CFLAGS)

# Add build directory tree to include path
CFLAGS += $(SOURCE_DIRS:%=$(INCLUDE_FLAG)%)

# Base build rules
%.o: %.c %.d $(MAKE_LIST)
	@echo Compiling $<
	@$(CC) -c $(CFLAGS) $< -o $@

%.a: $(MAKE_LIST)
	@echo Creating $@
	@rm -f $@; $(AR) $(ARFLAGS) $@ $(filter %.o, $^)

%.d: %.c $(MAKE_LIST)
	@echo Creating dependencies for $<
	@$(MAKEDEPEND)

# Microsoft has to be different
#%.obj: %.c %.d $(MAKE_LIST)
#	@echo Compiling $<
#	@$(CC) /c $(CFLAGS) /Fo"$@" $<
#
#%.lib: $(MAKE_LIST)
#	@echo Creating $@
#	@rm -f $@; $(AR) $(ARFLAGS) /out:"$@" $(filter %.obj, $^)

# Master Targets
libs: $(LIBS_TARGET_LIST)
	@echo $(shell date) > $@
	@echo All libs made.

all: $(LIBS_TARGET_LIST) $(OTHER_TARGET_LIST)
	@echo $(shell date) > $@
	@echo All targets made.

# Master install -- also create directories and scripts
install: all
	@echo Installing to $(INSTALL_ROOT)
	@[ -d $(INSTALL_ROOT) ] || mkdir $(INSTALL_ROOT); \
	[ -d $(INSTALL_ROOT)/include ] || mkdir $(INSTALL_ROOT)/include; \
	[ -d $(INSTALL_ROOT)/lib ] || mkdir $(INSTALL_ROOT)/lib; \
	[ -d $(INSTALL_ROOT)/lib/$(TARGET_OS) ] || mkdir $(INSTALL_ROOT)/lib/$(TARGET_OS); \
	[ -d $(INSTALL_ROOT)/demo ] || mkdir $(INSTALL_ROOT)/demo; \
	[ -d $(INSTALL_ROOT)/demo/$(TARGET_OS) ] || mkdir $(INSTALL_ROOT)/demo/$(TARGET_OS); \
	[ -d $(INSTALL_ROOT)/scripts ] || mkdir $(INSTALL_ROOT)/scripts; \
	[ -d $(INSTALL_ROOT)/scripts/$(TARGET_OS) ] || mkdir $(INSTALL_ROOT)/scripts/$(TARGET_OS)
ifneq ($(words $(INCLUDE_INSTALL_LIST)), 0)
	@cp -pf $(INCLUDE_INSTALL_LIST) $(INSTALL_ROOT)/include
endif
ifneq ($(words $(LIBS_TARGET_LIST)), 0)
	@cp -pf $(LIBS_TARGET_LIST) $(INSTALL_ROOT)/lib/$(TARGET_OS)
endif
ifneq ($(words $(DEMO_INSTALL_LIST)), 0)
ifeq ($(BUILD_EXECUTABLE), yes)
	@cp -pf $(DEMO_INSTALL_LIST) $(INSTALL_ROOT)/demo/$(TARGET_OS)
endif
endif
	@echo "#!/bin/sh" > $(INSTALL_ROOT)/scripts/$(TARGET_OS)/compile.sh; \
	echo "# Usage: compile filename" >> $(INSTALL_ROOT)/scripts/$(TARGET_OS)/compile.sh; \
	echo "# Will compile filename.c into filename.o" >> $(INSTALL_ROOT)/scripts/$(TARGET_OS)/compile.sh; \
	echo "$(CC) -c $(INCLUDE_FLAG)$(INSTALL_ROOT)/include $(SCRIPT_CFLAGS) \$$1.c -o \$$1.o" >> $(INSTALL_ROOT)/scripts/$(TARGET_OS)/compile.sh
	@echo "#!/bin/sh" > $(INSTALL_ROOT)/scripts/$(TARGET_OS)/link.sh; \
	echo "# Usage: link filename \"objectfile1.o objectfile2.o ...\" \"$(LIBS_FLAG)lib1 $(LIBS_FLAG)lib2 ...\"" >> $(INSTALL_ROOT)/scripts/$(TARGET_OS)/link.sh; \
	echo "# Will link object files into filename" >> $(INSTALL_ROOT)/scripts/$(TARGET_OS)/link.sh; \
	echo "$(LINK) -o \$$1 \$$2 $(LIBS_DIRFLAG)$(INSTALL_ROOT)/lib/$(TARGET_OS) $(LDFLAGS) \$$3" >> $(INSTALL_ROOT)/scripts/$(TARGET_OS)/link.sh
	@echo done.

# List of special targets that should not cause dependency generation
NODEPEND_TARGETS := default clean

# Clean up
.PHONY: clean
clean:
	@echo Cleaning all source directories and the top level directory.
	@rm -f all libs $(OTHER_TARGET_LIST) *.[aiodt] *.dbo $(foreach dir,$(SOURCE_DIRS), $(dir)/*.[odit] $(dir)/*.dbo)

# Generate dependencies only - which occurs as long as the include .d command occurs
.PHONY: depend
depend:
	@echo Only dependencies generated.

# Only allow building valid targets - eliminates strange errors with unknown targets
VALID_TARGETS := all libs install clean depend default $(LIBS_TARGET_LIST) $(OTHER_TARGET_LIST)
INVALID_TARGETS := $(filter-out $(VALID_TARGETS), $(MAKECMDGOALS))
ifneq ($(words $(INVALID_TARGETS)), 0)
$(error Cannot build $(INVALID_TARGETS). Valid targets are: $(VALID_TARGETS))
endif

# Include module dependency files - don't do it for special targets
DEPEND_TARGETS := $(filter-out $(NODEPEND_TARGETS), $(MAKECMDGOALS))
ifneq ($(words $(DEPEND_TARGETS)), 0)
-include $(SOURCE_LIST:.c=.d)
endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -