2017-05-26 04:48:44 +08:00
|
|
|
#
|
|
|
|
# vcxproj.mk
|
|
|
|
#
|
|
|
|
# This source file is part of the FoundationDB open source project
|
|
|
|
#
|
|
|
|
# Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
2018-02-22 02:25:11 +08:00
|
|
|
#
|
2017-05-26 04:48:44 +08:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
2018-02-22 02:25:11 +08:00
|
|
|
#
|
2017-05-26 04:48:44 +08:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2018-02-22 02:25:11 +08:00
|
|
|
#
|
2017-05-26 04:48:44 +08:00
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
# -*- mode: makefile; -*-
|
|
|
|
|
|
|
|
TARGETS += GENNAME
|
|
|
|
CLEAN_TARGETS += GENNAME()_clean
|
|
|
|
|
|
|
|
GENNAME()_ALL_SOURCES := $(addprefix GENDIR/,GENSOURCES)
|
|
|
|
|
2018-06-20 08:44:28 +08:00
|
|
|
GENNAME()_BUILD_SOURCES := $(patsubst %.actor.cpp,${OBJDIR}/%.actor.g.cpp,$(filter-out %.h %.hpp,$(GENNAME()_ALL_SOURCES)))
|
2018-06-19 07:46:59 +08:00
|
|
|
GENNAME()_GENERATED_SOURCES := $(patsubst %.actor.h,%.actor.g.h,$(patsubst %.actor.cpp,${OBJDIR}/%.actor.g.cpp,$(filter %.actor.h %.actor.cpp,$(GENNAME()_ALL_SOURCES))))
|
2017-05-26 04:48:44 +08:00
|
|
|
GENERATED_SOURCES += $(GENNAME()_GENERATED_SOURCES)
|
|
|
|
|
|
|
|
-include GENDIR/local.mk
|
|
|
|
|
2018-06-19 07:46:59 +08:00
|
|
|
# We need to include the current directory for .g.actor.cpp files emitted into
|
|
|
|
# .objs that use includes not based at the root of fdb.
|
|
|
|
GENNAME()_CFLAGS := -I GENDIR -I ${OBJDIR}/GENDIR ${GENNAME()_CFLAGS}
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
# If we have any static libs, we have to wrap them in the appropriate
|
|
|
|
# compiler flag magic
|
|
|
|
ifeq ($(GENNAME()_STATIC_LIBS),)
|
|
|
|
GENNAME()_STATIC_LIBS_REAL :=
|
|
|
|
else
|
2018-07-04 15:25:18 +08:00
|
|
|
# MacOS doesn't recognize -Wl,-Bstatic, but is happy with -Bstatic
|
|
|
|
# gcc will handle both, so we prefer the non -Wl version
|
|
|
|
GENNAME()_STATIC_LIBS_REAL := -Bstatic $(GENNAME()_STATIC_LIBS) -Bdynamic
|
2017-05-26 04:48:44 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
# If we have any -L directives in our LDFLAGS, we need to add those
|
|
|
|
# paths to the VPATH
|
|
|
|
VPATH += $(addprefix :,$(patsubst -L%,%,$(filter -L%,$(GENNAME()_LDFLAGS))))
|
|
|
|
|
|
|
|
IGNORE := $(shell echo $(VPATH))
|
|
|
|
|
2018-06-20 08:44:28 +08:00
|
|
|
GENNAME()_OBJECTS := $(addprefix $(OBJDIR)/,$(filter-out $(OBJDIR)/%,$(GENNAME()_BUILD_SOURCES:=.o))) $(filter $(OBJDIR)/%,$(GENNAME()_BUILD_SOURCES:=.o))
|
2017-05-26 04:48:44 +08:00
|
|
|
GENNAME()_DEPS := $(addprefix $(DEPSDIR)/,$(GENNAME()_BUILD_SOURCES:=.d))
|
|
|
|
|
|
|
|
.PHONY: GENNAME()_clean GENNAME
|
|
|
|
|
|
|
|
GENNAME: GENTARGET
|
|
|
|
|
2018-08-11 06:16:19 +08:00
|
|
|
$(CMDDIR)/GENDIR/compile_commands.json: build/project_commands.py ${GENNAME()_ALL_SOURCES}
|
|
|
|
@mkdir -p $(basename $@)
|
2018-08-14 06:46:00 +08:00
|
|
|
@build/project_commands.py --cflags="$(CFLAGS) $(GENNAME()_CFLAGS)" --cxxflags="$(CXXFLAGS) $(GENNAME()_CXXFLAGS)" --sources="$(GENNAME()_ALL_SOURCES)" --out="$@"
|
2018-08-11 06:16:19 +08:00
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
-include $(GENNAME()_DEPS)
|
|
|
|
|
2018-06-19 07:46:59 +08:00
|
|
|
$(OBJDIR)/GENDIR/%.actor.g.cpp: GENDIR/%.actor.cpp $(ACTORCOMPILER)
|
2017-05-26 04:48:44 +08:00
|
|
|
@echo "Actorcompiling $<"
|
2018-06-19 07:46:59 +08:00
|
|
|
@mkdir -p $(OBJDIR)/$(<D)
|
2017-05-26 04:48:44 +08:00
|
|
|
@$(MONO) $(ACTORCOMPILER) $< $@ >/dev/null
|
|
|
|
|
|
|
|
GENDIR/%.actor.g.h: GENDIR/%.actor.h $(ACTORCOMPILER)
|
|
|
|
@if [ -e $< ]; then echo "Actorcompiling $<" ; $(MONO) $(ACTORCOMPILER) $< $@ >/dev/null ; fi
|
2018-06-19 07:46:59 +08:00
|
|
|
.PRECIOUS: $(OBJDIR)/GENDIR/%.actor.g.cpp GENDIR/%.actor.g.h
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
# The order-only dependency on the generated .h files is to force make
|
|
|
|
# to actor compile all headers before attempting compilation of any .c
|
|
|
|
# or .cpp files. We have no mechanism to detect dependencies on
|
|
|
|
# generated headers before compilation.
|
|
|
|
|
|
|
|
$(OBJDIR)/GENDIR/%.cpp.o: GENDIR/%.cpp $(ALL_MAKEFILES) | $(filter %.h,$(GENERATED_SOURCES))
|
2018-06-21 05:35:02 +08:00
|
|
|
@echo "Compiling $(<:${OBJDIR}/%=%)"
|
|
|
|
ifeq ($(VERBOSE),1)
|
|
|
|
@echo $(CCACHE_CXX) $(CFLAGS) $(CXXFLAGS) $(GENNAME()_CFLAGS) $(GENNAME()_CXXFLAGS) -MMD -MT $@ -MF $(DEPSDIR)/$<.d.tmp -c $< -o $@
|
|
|
|
endif
|
|
|
|
@mkdir -p $(DEPSDIR)/$(<D) && \
|
|
|
|
mkdir -p $(OBJDIR)/$(<D) && \
|
|
|
|
$(CCACHE_CXX) $(CFLAGS) $(CXXFLAGS) $(GENNAME()_CFLAGS) $(GENNAME()_CXXFLAGS) -MMD -MT $@ -MF $(DEPSDIR)/$<.d.tmp -c $< -o $@ && \
|
|
|
|
cp $(DEPSDIR)/$<.d.tmp $(DEPSDIR)/$<.d && \
|
|
|
|
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' -e '/^$$/ d' -e 's/$$/ :/' < $(DEPSDIR)/$<.d.tmp >> $(DEPSDIR)/$<.d && \
|
|
|
|
rm $(DEPSDIR)/$<.d.tmp
|
2018-06-19 07:46:59 +08:00
|
|
|
|
|
|
|
$(OBJDIR)/GENDIR/%.cpp.o: $(OBJDIR)/GENDIR/%.cpp $(ALL_MAKEFILES) | $(filter %.h,$(GENERATED_SOURCES))
|
2018-06-21 05:35:02 +08:00
|
|
|
@echo "Compiling $(<:${OBJDIR}/%=%)"
|
|
|
|
ifeq ($(VERBOSE),1)
|
|
|
|
@echo $(CCACHE_CXX) $(CFLAGS) $(CXXFLAGS) $(GENNAME()_CFLAGS) $(GENNAME()_CXXFLAGS) -MMD -MT $@ -MF $(DEPSDIR)/$<.d.tmp -c $< -o $@
|
|
|
|
endif
|
|
|
|
@mkdir -p $(DEPSDIR)/$(<D) && \
|
|
|
|
mkdir -p $(OBJDIR)/$(<D) && \
|
|
|
|
$(CCACHE_CXX) $(CFLAGS) $(CXXFLAGS) $(GENNAME()_CFLAGS) $(GENNAME()_CXXFLAGS) -MMD -MT $@ -MF $(DEPSDIR)/$<.d.tmp -c $< -o $@ && \
|
|
|
|
cp $(DEPSDIR)/$<.d.tmp $(DEPSDIR)/$<.d && \
|
|
|
|
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' -e '/^$$/ d' -e 's/$$/ :/' < $(DEPSDIR)/$<.d.tmp >> $(DEPSDIR)/$<.d && \
|
|
|
|
rm $(DEPSDIR)/$<.d.tmp
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
$(OBJDIR)/GENDIR/%.c.o: GENDIR/%.c $(ALL_MAKEFILES) | $(filter %.h,$(GENERATED_SOURCES))
|
|
|
|
@echo "Compiling $<"
|
|
|
|
ifeq ($(VERBOSE),1)
|
|
|
|
@echo "$(CCACHE_CC) $(CFLAGS) $(GENNAME()_CFLAGS) -MMD -MT $@ -MF $(DEPSDIR)/$<.d.tmp -c $< -o $@"
|
|
|
|
endif
|
|
|
|
@mkdir -p $(DEPSDIR)/$(<D) && \
|
|
|
|
mkdir -p $(OBJDIR)/$(<D) && \
|
|
|
|
$(CCACHE_CC) $(CFLAGS) $(GENNAME()_CFLAGS) -MMD -MT $@ -MF $(DEPSDIR)/$<.d.tmp -c $< -o $@ && \
|
|
|
|
cp $(DEPSDIR)/$<.d.tmp $(DEPSDIR)/$<.d && \
|
|
|
|
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' -e '/^$$/ d' -e 's/$$/ :/' < $(DEPSDIR)/$<.d.tmp >> $(DEPSDIR)/$<.d && \
|
|
|
|
rm $(DEPSDIR)/$<.d.tmp
|
|
|
|
|
|
|
|
$(OBJDIR)/GENDIR/%.S.o: GENDIR/%.S $(ALL_MAKEFILES) | $(filter %.h,$(GENERATED_SOURCES))
|
|
|
|
@echo "Assembling $<"
|
|
|
|
ifeq ($(VERBOSE),1)
|
|
|
|
@echo "$(CCACHE_CC) $(CFLAGS) $(GENNAME()_CFLAGS) -MMD -MT $@ -MF $(DEPSDIR)/$<.d.tmp -c $< -o $@"
|
|
|
|
endif
|
|
|
|
@mkdir -p $(DEPSDIR)/$(<D) && \
|
|
|
|
mkdir -p $(OBJDIR)/$(<D) && \
|
|
|
|
$(CCACHE_CC) $(CFLAGS) $(GENNAME()_CFLAGS) -MMD -MT $@ -MF $(DEPSDIR)/$<.d.tmp -c $< -o $@ && \
|
|
|
|
cp $(DEPSDIR)/$<.d.tmp $(DEPSDIR)/$<.d && \
|
|
|
|
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' -e '/^$$/ d' -e 's/$$/ :/' < $(DEPSDIR)/$<.d.tmp >> $(DEPSDIR)/$<.d && \
|
|
|
|
rm $(DEPSDIR)/$<.d.tmp
|
|
|
|
|
|
|
|
GENNAME()_clean:
|
|
|
|
@echo "Cleaning GENNAME"
|
|
|
|
@rm -f GENTARGET $(GENNAME()_GENERATED_SOURCES) GENTARGET().debug GENTARGET()-debug
|
|
|
|
@rm -rf $(DEPSDIR)/GENDIR
|
|
|
|
@rm -rf $(OBJDIR)/GENDIR
|
|
|
|
|
2018-07-04 15:25:18 +08:00
|
|
|
GENTARGET: $(GENNAME()_OBJECTS) $(GENNAME()_LIBS) $(ALL_MAKEFILES) build/link-wrapper.sh build/link-validate.sh
|
2017-05-26 04:48:44 +08:00
|
|
|
@mkdir -p GENOUTDIR
|
|
|
|
@./build/link-wrapper.sh GENCONFIGTYPE GENNAME $@ $(TARGET_LIBC_VERSION)
|