8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 22:43:03 +01:00
firebird-mirror/extern/cloop/Makefile

163 lines
4.3 KiB
Makefile
Raw Normal View History

2015-04-07 15:56:06 +02:00
MODULES := cloop tests tests/test1
WITH_FPC := 1
TARGET := release
2016-05-25 14:14:01 +02:00
CC := $(CC)
CXX := $(CXX)
LD := $(CXX)
2015-04-07 15:56:06 +02:00
SRC_DIR := src
BUILD_DIR := build
OUT_DIR := output
SHRLIB_EXT := .so
EXE_EXT :=
OBJ_DIR := $(BUILD_DIR)/$(TARGET)
BIN_DIR := $(OUT_DIR)/$(TARGET)/bin
LIB_DIR := $(OUT_DIR)/$(TARGET)/lib
SRC_DIRS := $(addprefix $(SRC_DIR)/,$(MODULES))
OBJ_DIRS := $(addprefix $(OBJ_DIR)/,$(MODULES))
SRCS_C := $(foreach sdir,$(SRC_DIRS),$(wildcard $(sdir)/*.c))
SRCS_CPP := $(foreach sdir,$(SRC_DIRS),$(wildcard $(sdir)/*.cpp))
OBJS_C := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRCS_C))
OBJS_CPP := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRCS_CPP))
C_FLAGS := -ggdb -fPIC -MMD -MP -W -Wall -Wno-unused-parameter
CXX_FLAGS := $(C_FLAGS) -std=c++11
FPC_FLAGS := -Mdelphi -Cg
2015-04-07 15:56:06 +02:00
ifeq ($(shell uname),FreeBSD)
DL_LIB :=
else
DL_LIB := -ldl
endif
2015-04-07 15:56:06 +02:00
ifeq ($(TARGET),release)
CXX_FLAGS += -O3
endif
2019-12-04 11:59:38 +01:00
ifeq ($(shell uname),Darwin)
2019-11-28 16:54:50 +01:00
CXX_FLAGS += -stdlib=libc++
2019-12-04 11:59:38 +01:00
endif
2019-11-28 16:54:50 +01:00
2015-04-07 15:56:06 +02:00
ifeq ($(TARGET),debug)
FPC_FLAGS += -g
LD_FLAGS += -ggdb
2015-04-07 15:56:06 +02:00
endif
vpath %.c $(SRC_DIRS)
vpath %.cpp $(SRC_DIRS)
define compile
$1/%.o: %.c | $1
2015-04-07 15:56:06 +02:00
$(CC) -c $$(C_FLAGS) $$< -o $$@
$1/%.o: %.cpp | $1
2015-04-07 15:56:06 +02:00
$(CXX) -c $$(CXX_FLAGS) $$< -o $$@
endef
.PHONY: all core mkdirs clean
2015-04-07 15:56:06 +02:00
all: core tests
core: mkdirs \
$(BIN_DIR)/cloop
tests: mkdirs \
2015-04-07 15:56:06 +02:00
$(BIN_DIR)/test1-c$(SHRLIB_EXT) \
$(BIN_DIR)/test1-c$(EXE_EXT) \
$(BIN_DIR)/test1-cpp$(SHRLIB_EXT) \
$(BIN_DIR)/test1-cpp$(EXE_EXT) \
$(BIN_DIR)/test1-pascal$(SHRLIB_EXT) \
$(BIN_DIR)/test1-pascal$(EXE_EXT)
mkdirs: $(OBJ_DIRS) $(BIN_DIR) $(LIB_DIR)
$(OBJ_DIRS) $(BIN_DIR) $(LIB_DIR):
@mkdir -p $@
clean:
@rm -rf $(BUILD_DIR) $(OUT_DIR)
$(foreach bdir,$(OBJ_DIRS),$(eval $(call compile,$(bdir))))
-include $(addsuffix .d,$(basename $(OBJS_C)))
-include $(addsuffix .d,$(basename $(OBJS_CPP)))
$(BIN_DIR)/cloop: \
$(OBJ_DIR)/cloop/Action.o \
2015-04-07 15:56:06 +02:00
$(OBJ_DIR)/cloop/Expr.o \
$(OBJ_DIR)/cloop/Generator.o \
$(OBJ_DIR)/cloop/Lexer.o \
$(OBJ_DIR)/cloop/Parser.o \
$(OBJ_DIR)/cloop/Main.o \
extern/cloop: Missing dependency of $(BIN_DIR)/cloop on $(BIN_DIR) When building Firebird 3.0.7 as part of LibreOffice, I saw it fail once (at <https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/74624/>) with [...] > config.status: creating gen/Makefile.extern.editline > config.status: creating src/include/gen/autoconfig.auto > config.status: executing libtool commands > > > The Firebird3 package has been configured with the following options: > > Raw devices : enabled > Service name : gds_db > Service port : 3050 > GPRE modules : c_cxx.cpp > > Install Dir : /usr/local/firebird > > mkpar.c:182:2: warning: add explicit braces to avoid dangling else [-Wdangling-else] > else > ^ > 1 warning generated. > main.o: In function `create_file_names': > main.c:(.text+0x976): warning: the use of `mktemp' is dangerous, better use `mkstemp' > /usr/bin/ld: cannot open output file /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/UnpackedTarball/firebird/gen/Debug/cloop/release/bin/cloop: No such file or directory > clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation) > Makefile:84: recipe for target '/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/UnpackedTarball/firebird/gen/Debug/cloop/release/bin/cloop' failed > make[6]: *** [/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/UnpackedTarball/firebird/gen/Debug/cloop/release/bin/cloop] Error 1 > make[6]: Target 'all' not remade because of errors. > Makefile:130: recipe for target 'extern' failed > make[5]: *** [extern] Error 2 > Makefile:181: recipe for target 'master_process' failed > make[4]: *** [master_process] Error 2 > Makefile:72: recipe for target 'Debug' failed > make[3]: *** [Debug] Error 2 > Makefile:6: recipe for target 'Debug' failed > make[2]: *** [Debug] Error 2 > /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/external/firebird/ExternalProject_firebird.mk:29: recipe for target '/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/ExternalProject/firebird/build' failed > make[1]: *** [/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/ExternalProject/firebird/build] Error 1 [...]
2020-12-03 13:56:34 +01:00
| $(BIN_DIR)
2015-04-07 15:56:06 +02:00
$(LD) $(LD_FLAGS) $^ -o $@ $(LIBS)
2015-04-07 15:56:06 +02:00
$(SRC_DIR)/tests/test1/CalcCApi.h: $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl
$(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl c-header $@ CALC_C_API_H CALC_I
$(SRC_DIR)/tests/test1/CalcCApi.c: $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl $(SRC_DIR)/tests/test1/CalcCApi.h
$(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl c-impl $@ CalcCApi.h CALC_I
$(SRC_DIR)/tests/test1/CalcCppApi.h: $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl
$(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl c++ $@ CALC_CPP_API_H calc I
$(SRC_DIR)/tests/test1/CalcPascalApi.pas: $(BIN_DIR)/cloop \
$(SRC_DIR)/tests/test1/Interface.idl \
$(SRC_DIR)/tests/test1/CalcPascalApi.interface.pas \
$(SRC_DIR)/tests/test1/CalcPascalApi.implementation.pas
$(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl pascal $@ CalcPascalApi \
--uses "SysUtils" \
--interfaceFile $(SRC_DIR)/tests/test1/CalcPascalApi.interface.pas \
--implementationFile $(SRC_DIR)/tests/test1/CalcPascalApi.implementation.pas \
--exceptionClass CalcException
2015-04-07 15:56:06 +02:00
$(SRC_DIR)/tests/test1/CppTest.cpp: $(SRC_DIR)/tests/test1/CalcCppApi.h
$(BIN_DIR)/test1-c$(SHRLIB_EXT): \
$(OBJ_DIR)/tests/test1/CalcCApi.o \
$(OBJ_DIR)/tests/test1/CTest.o \
$(LD) $(LD_FLAGS) $^ -shared $(DL_LIB) -o $@ $(LIBS)
2015-04-07 15:56:06 +02:00
$(BIN_DIR)/test1-c$(EXE_EXT): \
$(OBJ_DIR)/tests/test1/CalcCApi.o \
$(OBJ_DIR)/tests/test1/CTest.o \
$(LD) $(LD_FLAGS) $^ $(DL_LIB) -o $@ $(LIBS)
2015-04-07 15:56:06 +02:00
$(BIN_DIR)/test1-cpp$(SHRLIB_EXT): \
$(OBJ_DIR)/tests/test1/CppTest.o \
$(LD) $(LD_FLAGS) $^ -shared $(DL_LIB) -o $@ $(LIBS)
2015-04-07 15:56:06 +02:00
$(BIN_DIR)/test1-cpp$(EXE_EXT): \
$(OBJ_DIR)/tests/test1/CppTest.o \
$(LD) $(LD_FLAGS) $^ $(DL_LIB) -o $@ $(LIBS)
2015-04-07 15:56:06 +02:00
$(BIN_DIR)/test1-pascal$(SHRLIB_EXT): \
$(SRC_DIR)/tests/test1/PascalClasses.pas \
$(SRC_DIR)/tests/test1/PascalLibrary.dpr \
$(SRC_DIR)/tests/test1/CalcPascalApi.pas \
ifeq ($(WITH_FPC),1)
fpc $(FPC_FLAGS) -fPIC -FU$(OBJ_DIR)/tests/test1 -o$(BIN_DIR)/test1-pascal$(SHRLIB_EXT) $(SRC_DIR)/tests/test1/PascalLibrary.dpr
endif
$(BIN_DIR)/test1-pascal$(EXE_EXT): \
$(SRC_DIR)/tests/test1/PascalClasses.pas \
$(SRC_DIR)/tests/test1/PascalTest.dpr \
$(SRC_DIR)/tests/test1/CalcPascalApi.pas \
ifeq ($(WITH_FPC),1)
fpc $(FPC_FLAGS) -FU$(OBJ_DIR)/tests/test1 -o$(BIN_DIR)/test1-pascal$(EXE_EXT) $(SRC_DIR)/tests/test1/PascalTest.dpr
endif