| 1 | ############################################################################### |
| 2 | # Copyright (c) 2000-2015 Ericsson Telecom AB |
| 3 | # All rights reserved. This program and the accompanying materials |
| 4 | # are made available under the terms of the Eclipse Public License v1.0 |
| 5 | # which accompanies this distribution, and is available at |
| 6 | # http://www.eclipse.org/legal/epl-v10.html |
| 7 | ############################################################################### |
| 8 | TOPDIR := .. |
| 9 | include ../Makefile.regression |
| 10 | |
| 11 | # |
| 12 | # Do NOT touch this line... |
| 13 | # |
| 14 | .PHONY: all archive check clean dep objects |
| 15 | |
| 16 | .SUFFIXES: .d |
| 17 | |
| 18 | # |
| 19 | # Set these variables... |
| 20 | # |
| 21 | |
| 22 | |
| 23 | # Flags for the C++ preprocessor (and makedepend as well): |
| 24 | CPPFLAGS += -I../../core/loggerapi -I.. |
| 25 | |
| 26 | # Flags for dependency generation |
| 27 | CXXDEPFLAGS = -MM |
| 28 | |
| 29 | # Flags for the C++ compiler: -Wall |
| 30 | #CXXFLAGS += |
| 31 | |
| 32 | # Flags for the linker: |
| 33 | #LDFLAGS += |
| 34 | |
| 35 | # Flags for the TTCN-3 and ASN.1 compiler: |
| 36 | ifeq ($(findstring -L,$(TTCN3_COMPILER)),) |
| 37 | # logfilecheck requires location info. |
| 38 | COMPILER_FLAGS += -L |
| 39 | endif |
| 40 | |
| 41 | # Execution mode: (either ttcn3 or ttcn3-parallel) |
| 42 | TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX) |
| 43 | |
| 44 | # |
| 45 | # You may change these variables. Add your files if necessary... |
| 46 | # |
| 47 | |
| 48 | # TTCN-3 modules of this project: |
| 49 | TTCN3_MODULES := logcontrol.ttcn TitanLoggerControl.ttcn |
| 50 | |
| 51 | # ASN.1 modules of this project: |
| 52 | ASN1_MODULES = |
| 53 | |
| 54 | # C++ source & header files generated from the TTCN-3 & ASN.1 modules of |
| 55 | # this project: |
| 56 | GENERATED_SOURCES := $(TTCN3_MODULES:.ttcn=.cc) $(ASN1_MODULES:.asn=.cc) |
| 57 | GENERATED_HEADERS := $(GENERATED_SOURCES:.cc=.hh) |
| 58 | |
| 59 | # C/C++ Source & header files of Test Ports, external functions and |
| 60 | # other modules: |
| 61 | USER_SOURCES := |
| 62 | USER_HEADERS := |
| 63 | |
| 64 | GENERATED_OBJECTS := $(GENERATED_SOURCES:.cc=.o) |
| 65 | |
| 66 | USER_OBJECTS := $(USER_SOURCES:.cc=.o) |
| 67 | |
| 68 | # Object files of this project that are needed for the executable test suite: |
| 69 | OBJECTS = $(GENERATED_OBJECTS) $(USER_OBJECTS) |
| 70 | |
| 71 | DEPFILES = $(USER_OBJECTS:.o=.d) $(GENERATED_OBJECTS:.o=.d) |
| 72 | |
| 73 | # Other files of the project (Makefile, configuration files, etc.) |
| 74 | # that will be added to the archived source files: |
| 75 | OTHER_FILES = Makefile |
| 76 | |
| 77 | # The name of the executable test suite: |
| 78 | TARGET = logcontrol$(EXESUFFIX) |
| 79 | |
| 80 | # |
| 81 | # Rules for building the executable... |
| 82 | # |
| 83 | |
| 84 | all: $(TARGET) ; |
| 85 | |
| 86 | objects: $(OBJECTS) ; |
| 87 | |
| 88 | $(TARGET): $(OBJECTS) |
| 89 | $(TTCN3_DIR)/bin/titanver $(OBJECTS) |
| 90 | $(CXX) $(LDFLAGS) -o $@ $^ \ |
| 91 | -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \ |
| 92 | -L$(OPENSSL_DIR)/lib -lcrypto \ |
| 93 | -L$(XMLDIR)/lib $($(PLATFORM)_LIBS) |
| 94 | |
| 95 | .cc.o .c.o: |
| 96 | $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< |
| 97 | |
| 98 | .cc.d .c.d: |
| 99 | @echo Creating dependency file for '$<'; set -e; \ |
| 100 | $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \ |
| 101 | | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ |
| 102 | [ -s $@ ] || rm -f $@ |
| 103 | |
| 104 | $(GENERATED_SOURCES) $(GENERATED_HEADERS): compile |
| 105 | @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi |
| 106 | |
| 107 | compile: $(TTCN3_MODULES) $(ASN1_MODULES) |
| 108 | $(TTCN3_COMPILER) $(COMPILER_FLAGS) $^ - $? |
| 109 | touch $@ |
| 110 | |
| 111 | clean: |
| 112 | -$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ |
| 113 | $(GENERATED_SOURCES) compile $(DEPFILES) \ |
| 114 | tags *.log |
| 115 | |
| 116 | distclean: clean |
| 117 | -$(RM) TitanLoggerControl.ttcn |
| 118 | |
| 119 | dep: $(GENERATED_SOURCES) $(USER_SOURCES) ; |
| 120 | |
| 121 | ifeq ($(findstring n,$(MAKEFLAGS)),) |
| 122 | ifeq ($(filter clean distclean check compile archive diag,$(MAKECMDGOALS)),) |
| 123 | -include $(DEPFILES) |
| 124 | endif |
| 125 | endif |
| 126 | |
| 127 | |
| 128 | diag: |
| 129 | $(TTCN3_DIR)/bin/compiler -v 2>&1 |
| 130 | $(TTCN3_DIR)/bin/mctr_cli -v 2>&1 |
| 131 | $(CXX) -v 2>&1 @echo TTCN3_DIR=$(TTCN3_DIR) |
| 132 | @echo OPENSSL_DIR=$(OPENSSL_DIR) |
| 133 | @echo XMLDIR=$(XMLDIR) |
| 134 | @echo PLATFORM=$(PLATFORM) |
| 135 | |
| 136 | # |
| 137 | # Add your rules here if necessary... |
| 138 | # |
| 139 | |
| 140 | run: $(TARGET) config.cfg |
| 141 | rm -f *.log |
| 142 | ./$^ |
| 143 | $(ABS_SRC)/logfilecheck |
| 144 | |
| 145 | # files from the runtime |
| 146 | TitanLoggerControl.ttcn: ../../core/TitanLoggerControl.ttcn |
| 147 | ln -s $< $@ |
| 148 | |