diff options
Diffstat (limited to 'lib/megaco/src/flex/Makefile.in')
-rw-r--r-- | lib/megaco/src/flex/Makefile.in | 396 |
1 files changed, 396 insertions, 0 deletions
diff --git a/lib/megaco/src/flex/Makefile.in b/lib/megaco/src/flex/Makefile.in new file mode 100644 index 0000000000..782d6a4807 --- /dev/null +++ b/lib/megaco/src/flex/Makefile.in @@ -0,0 +1,396 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2001-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% + +include $(ERL_TOP)/make/target.mk + +EBIN = ../../ebin +MEGACO_INCLUDEDIR = ../../include + +include $(ERL_TOP)/make/$(TARGET)/otp.mk + + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../../vsn.mk +VSN=$(MEGACO_VSN) + + +# ---------------------------------------------------- +# The following variables differ on different systems, we set +# reasonable defaults, if something different is needed it should +# be set for that system only. +# ---------------------------------------------------- + +FLEX_VSN = $(shell flex --version) + +TMP_CFLAGS = @DED_CFLAGS@ +ifeq ($(TYPE),valgrind) +CFLAGS = $(subst -O2, , $(TMP_CFLAGS)) -DVALGRIND +else +CFLAGS = $(TMP_CFLAGS) +endif +CC = @CC@ +CFLAGS_MT = $(CFLAGS) -D_THREAD_SAFE -D_REENTRANT +LD = @DED_LD@ +LDFLAGS = @DED_LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +PERL = @PERL@ +ERLANG_OSTYPE = @ERLANG_OSTYPE@ + +# Shall we build the flex scanner or not. +# We assume that it does not exist on windows... +ifeq ($(ENABLE_MEGACO_FLEX_SCANNER),) +ifeq ($(findstring win32,$(TARGET)), win32) +ENABLE_MEGACO_FLEX_SCANNER = false +ENABLE_REENTRANT_MEGACO_FLEX_SCANNER = false +else +ENABLE_MEGACO_FLEX_SCANNER = @ENABLE_MEGACO_FLEX_SCANNER@ +ENABLE_REENTRANT_MEGACO_FLEX_SCANNER = @ENABLE_REENTRANT_MEGACO_FLEX_SCANNER@ +endif +endif +ERL_COMPILE_FLAGS += -DENABLE_MEGACO_FLEX_SCANNER=$(ENABLE_MEGACO_FLEX_SCANNER) + +ifeq ($(ENABLE_REENTRANT_MEGACO_FLEX_SCANNER),true) +CFLAGS_MT += -DMEGACO_REENTRANT_FLEX_SCANNER +MT_LEX_FLAGS += -R +ERL_COMPILE_FLAGS += -DMEGACO_REENTRANT_FLEX_SCANNER=true +else +ERL_COMPILE_FLAGS += -DMEGACO_REENTRANT_FLEX_SCANNER=false +endif + +# Shall the library be built with line-number checks or without +ifeq ($(ENABLE_MEGACO_FLEX_SCANNER_LINENO),) +# This is not really needed in this case (since we don't support +# this for windows), but just to ensure that the variable _has_ +# a value... +ifeq ($(findstring win32,$(TARGET)), win32) +ENABLE_MEGACO_FLEX_SCANNER_LINENO = true +else +ENABLE_MEGACO_FLEX_SCANNER_LINENO = @ENABLE_MEGACO_FLEX_SCANNER_LINENO@ +endif +endif + + +SYSINCLUDE = -I$(ERL_TOP)/erts/emulator/beam \ + -I$(ERL_TOP)/erts/emulator/sys/$(ERLANG_OSTYPE) +ifeq ($(findstring vxworks,$(TARGET)),vxworks) + SYSINCLUDE += -I$(ERL_TOP)/erts/etc/vxworks +endif + +DRIVER_INCLUDES = $(SYSINCLUDE) + +PRIVDIR = ../../priv +LIBDIR = $(PRIVDIR)/lib/$(TARGET) + + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/lib/megaco-$(VSN) + + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- + +include modules.mk + +ERL_FILES = $(MODULES:%=%.erl) + +TARGET_FILES = \ + $(MODULES:%=$(EBIN)/%.$(EMULATOR)) + +FLEX_SRC = $(FLEX_MODULES:%=%.flex.src) +FLEX_FILES = $(STD_DRV).flex $(MT_DRV).flex + +C_TARGETS = $(STD_DRV).c $(MT_DRV).c + + +# ---------------------------------------------------- +# Misc Macros +# ---------------------------------------------------- + +STD_DRV_NAME=-DMEGACO_DRV_NAME=\"$(STD_DRV)\" +MT_DRV_NAME=-DMEGACO_DRV_NAME=\"$(MT_DRV)\" + +ifeq ($(findstring win32,$(TARGET)), win32) +FLEX_SCANNER_SO = +SOLIBS = $(FLEX_SCANNER_SO) +else +ifeq ($(findstring vxworks,$(TARGET)),vxworks) +FLEX_SCANNER_SO = +SOLIBS = $(FLEX_SCANNER_SO) +else +FLEX_SCANNER_SO = $(LIBDIR)/$(STD_DRV).so +FLEX_SCANNER_MT_SO = $(LIBDIR)/$(MT_DRV).so +SOLIBS = $(FLEX_SCANNER_SO) $(FLEX_SCANNER_MT_SO) +endif +endif + + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +ifeq ($(TYPE),debug) +ERL_COMPILE_FLAGS += -Ddebug +endif + +include ../app/megaco.mk + +ERL_COMPILE_FLAGS += \ + $(MEGACO_ERL_COMPILE_FLAGS) \ + -I../../include + +ifeq ($(MFS_DEBUG),true) +CFLAGS += -DMFS_DEBUG=true +endif + +ifeq ($(MFS_FLEX_PERF),true) +STD_LEX_FLAGS += -p +MT_LEX_FLAGS += -p +endif + +ifeq ($(MFS_FLEX_DEBUG),true) +CFLAGS += -DMFS_FLEX_DEBUG=1 +STD_LEX_FLAGS += -d +MT_LEX_FLAGS += -d +else +CFLAGS += -DMFS_FLEX_DEBUG=0 +endif + +CFLAGS += $(DRIVER_INCLUDES) $(DRV_FLAGS) -funroll-loops -Wall + +#ifneq ($(FLEX_VSN),) +#CFLAGS += -DFLEX_VERSION="$(FLEX_VSN)" +#else +#CFLAGS += -DFLEX_VERSION=unknown +#endif + +ifeq ($(ENABLE_MEGACO_FLEX_SCANNER_LINENO),true) +CFLAGS += -DMEGACO_LINENO +STD_LEX_FLAGS += -Ca +MT_LEX_FLAGS += -Ca +ifeq ($(ENABLE_REENTRANT_MEGACO_FLEX_SCANNER),true) +MT_LEX_FLAGS += --yylineno +endif +else +CFLAGS += -DMEGACO_TOKENCNT +STD_LEX_FLAGS += -Cfe +MT_LEX_FLAGS += -Cfe +endif + + + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +ifeq ($(ENABLE_MEGACO_FLEX_SCANNER),true) +debug opt: $(TARGET_FILES) $(C_TARGETS) solibs +else +debug opt: $(TARGET_FILES) +endif + +clean: + rm -f $(TARGET_FILES) + rm -f $(FLEX_FILES) + rm -f $(C_TARGETS) + rm -f $(SOLIBS) + rm -f errs core *~ + +docs: + +info: + @echo "ENABLE_MEGACO_FLEX_SCANNER = $(ENABLE_MEGACO_FLEX_SCANNER)" + @echo "ENABLE_MEGACO_FLEX_SCANNER_LINENO = $(ENABLE_MEGACO_FLEX_SCANNER_LINENO)" + @echo "ENABLE_REENTRANT_MEGACO_FLEX_SCANNER = $(ENABLE_REENTRANT_MEGACO_FLEX_SCANNER)" + @echo "" + @echo "FLEX_VSN = $(FLEX_VSN)" + @echo "" + @echo "CFLAGS = $(CFLAGS)" + @echo "CFLAGS_MT = $(CFLAGS_MT)" + @echo "DRV_FLAGS = $(DRV_FLAGS)" + @echo "STD_LEX_FLAGS = $(STD_LEX_FLAGS)" + @echo "MT_LEX_FLAGS = $(MT_LEX_FLAGS)" + @echo "" + @echo "MODULES = $(MODULES)" + @echo "ERL_FILES = $(ERL_FILES)" + @echo "TARGET_FILES = $(TARGET_FILES)" + @echo "" + @echo "FLEX_MODULES = $(FLEX_MODULES)" + @echo "FLEX_SRC = $(FLEX_SRC)" + @echo "FLEX_FILES = $(FLEX_FILES)" + @echo "" + @echo "C_TARGETS = $(C_TARGETS)" + @echo "" + @echo "LIBDIR = $(LIBDIR)" + @echo "LEXLIB = $(LEXLIB)" + @echo "" + @echo "STD_DRV = $(STD_DRV)" + @echo "MT_DRV = $(MT_DRV)" + @echo "" + @echo "STD_DRV_NAME = $(STD_DRV_NAME)" + @echo "MT_DRV_NAME = $(MT_DRV_NAME)" + @echo "" + @echo "SOLIBS = $(SOLIBS)" + + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + + +release_spec: opt + $(INSTALL_DIR) $(RELSYSDIR)/ebin + $(INSTALL_DIR) $(RELSYSDIR)/src + $(INSTALL_DIR) $(RELSYSDIR)/src/flex + $(INSTALL_DIR) $(RELSYSDIR)/priv/lib + $(INSTALL_DIR) $(RELSYSDIR)/include + $(INSTALL_DATA) $(ERL_FILES) $(INTERNAL_HRL_FILES) $(RELSYSDIR)/src/flex + $(INSTALL_DATA) $(TARGET_FILES) $(RELSYSDIR)/ebin +ifeq ($(ENABLE_MEGACO_FLEX_SCANNER),true) + $(INSTALL_DATA) $(FLEX_FILES) $(C_TARGETS) $(RELSYSDIR)/src/flex + $(INSTALL_DATA) $(SOLIBS) $(RELSYSDIR)/priv/lib +endif + + +release_docs_spec: + +# megaco_flex_scanner_drv.flex: megaco_flex_scanner_drv.flex.src +# ifeq ($(ENABLE_MEGACO_FLEX_SCANNER_LINENO),true) +# ifeq ($(ENABLE_REENTRANT_MEGACO_FLEX_SCANNER),true) +# @printf "\treentrant [flex] scanner lineno enabled\n" +# $(PERL) -p -e \ +# 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ +# s/%MEGACO_YY_LINENO_OPTION%/%option yylineno/ ; \ +# s/%MEGACO_YY_REENTRANT_OPTION%/%option reentrant/ ; \ +# s/%MEGACO_DUMMY_DECL_YY_LINENO%/\/* static int yylineno = 1; *\//' \ +# < $< > $@ +# else +# @printf "\tnon-reentrant [flex] scanner lineno enabled\n" +# $(PERL) -p -e \ +# 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ +# s/%MEGACO_YY_LINENO_OPTION%/%option yylineno/ ; \ +# s/%MEGACO_YY_REENTRANT_OPTION%/\/\* %option reentrant \*\// ; \ +# s/%MEGACO_DUMMY_DECL_YY_LINENO%/\/* static int yylineno = 1; *\//' \ +# < $< > $@ +# endif +# else +# ifeq ($(ENABLE_REENTRANT_MEGACO_FLEX_SCANNER),true) +# @printf "\treentrant [flex] scanner lineno disabled\n" +# $(PERL) -p -e \ +# 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ +# s/%MEGACO_YY_LINENO_OPTION%/\/\* %option yylineno \*\// ; \ +# s/%MEGACO_YY_REENTRANT_OPTION%/%option reentrant/ ; \ +# s/%MEGACO_DUMMY_DECL_YY_LINENO%/\/* static int yylineno = 1; - REENTRANT SCANNER*\//' \ +# < $< > $@ +# else +# @printf "\tnon-reentrant [flex] scanner lineno disabled\n" +# $(PERL) -p -e \ +# 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ +# s/%MEGACO_YY_LINENO_OPTION%/\/\* %option yylineno \*\// ; \ +# s/%MEGACO_YY_REENTRANT_OPTION%/\/\* %option reentrant \*\// ; \ +# s/%MEGACO_DUMMY_DECL_YY_LINENO%/static int yylineno = 1;/' \ +# < $< > $@ +# endif +# endif +# + +$(STD_DRV).flex: megaco_flex_scanner_drv.flex.src +ifeq ($(ENABLE_MEGACO_FLEX_SCANNER_LINENO),true) + @printf "std [flex] scanner - lineno enabled\n" + $(PERL) -p -e \ + 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ + s/%MEGACO_YY_LINENO_OPTION%/%option yylineno/ ; \ + s/%MEGACO_YY_REENTRANT_OPTION%/\/\* %option reentrant \*\// ; \ + s/%MEGACO_DUMMY_DECL_YY_LINENO%/\/* static int yylineno = 1; *\//' \ + < $< > $@ +else + @printf "std [flex] scanner - lineno disabled\n" + $(PERL) -p -e \ + 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ + s/%MEGACO_YY_LINENO_OPTION%/\/\* %option yylineno \*\// ; \ + s/%MEGACO_YY_REENTRANT_OPTION%/\/\* %option reentrant \*\// ; \ + s/%MEGACO_DUMMY_DECL_YY_LINENO%/static int yylineno = 1;/' \ + < $< > $@ +endif + +$(MT_DRV).flex: megaco_flex_scanner_drv.flex.src +ifeq ($(ENABLE_MEGACO_FLEX_SCANNER_LINENO),true) +ifeq ($(ENABLE_REENTRANT_MEGACO_FLEX_SCANNER),true) + @printf "multi-threaded reentrant [flex] scanner - lineno enabled\n" + $(PERL) -p -e \ + 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ + s/%MEGACO_YY_LINENO_OPTION%/%option yylineno/ ; \ + s/%MEGACO_YY_REENTRANT_OPTION%/%option reentrant/ ; \ + s/%MEGACO_DUMMY_DECL_YY_LINENO%/\/* static int yylineno = 1; *\//' \ + < $< > $@ +else + @printf "multi-threaded non-reentrant [flex] scanner - lineno enabled\n" + $(PERL) -p -e \ + 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ + s/%MEGACO_YY_LINENO_OPTION%/%option yylineno/ ; \ + s/%MEGACO_YY_REENTRANT_OPTION%/\/\* %option reentrant \*\// ; \ + s/%MEGACO_DUMMY_DECL_YY_LINENO%/\/* static int yylineno = 1; *\//' \ + < $< > $@ +endif +else +ifeq ($(ENABLE_REENTRANT_MEGACO_FLEX_SCANNER),true) + @printf "multi-threaded reentrant [flex] scanner - lineno disabled\n" + $(PERL) -p -e \ + 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ + s/%MEGACO_YY_LINENO_OPTION%/\/\* %option yylineno \*\// ; \ + s/%MEGACO_YY_REENTRANT_OPTION%/%option reentrant/ ; \ + s/%MEGACO_DUMMY_DECL_YY_LINENO%/\/* static int yylineno = 1; - REENTRANT SCANNER*\//' \ + < $< > $@ +else + @printf "multi-threaded non-reentrant [flex] scanner - lineno disabled\n" + $(PERL) -p -e \ + 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ + s/%MEGACO_YY_LINENO_OPTION%/\/\* %option yylineno \*\// ; \ + s/%MEGACO_YY_REENTRANT_OPTION%/\/\* %option reentrant \*\// ; \ + s/%MEGACO_DUMMY_DECL_YY_LINENO%/static int yylineno = 1;/' \ + < $< > $@ +endif +endif + +# megaco_flex_scanner_drv.c: megaco_flex_scanner_drv.flex +# $(LEX) $(LEX_FLAGS) -P$* -o$@ $< +$(STD_DRV).c: $(STD_DRV).flex + $(LEX) $(STD_LEX_FLAGS) -P$* -o$@ $< +$(MT_DRV).c: $(MT_DRV).flex + $(LEX) $(MT_LEX_FLAGS) -P$* -o$@ $< + +solibs: $(LIBDIR) $(SOLIBS) + +# No need to link with -lfl as we have also defined %option noyywrap - +# and having -lfl doesn't work under Darwin for some reason. - Sean +$(LIBDIR)/$(STD_DRV).so: $(STD_DRV).c + @echo "std driver:" + $(CC) $(STD_DRV_NAME) $(CFLAGS) $(LDFLAGS) -o $(LIBDIR)/$(STD_DRV).so $< + +$(LIBDIR)/$(MT_DRV).so: $(MT_DRV).c + @echo "multi-threaded driver:" + $(CC) $(MT_DRV_NAME) $(CFLAGS_MT) $(LDFLAGS) -o $(LIBDIR)/$(MT_DRV).so $< + +$(LIBDIR): + -mkdir -p $(LIBDIR) + |