Skip to content

Commit

Permalink
#d4978ec introducing a kind of svn externals
Browse files Browse the repository at this point in the history
  • Loading branch information
seeduvax committed Mar 6, 2024
1 parent 9e6faae commit c4ce7da
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<cr id="d4978ecd80126914b54f913ed5a5ce7d27fcb726a7ce81f194c071bf6a9966bf" state="open">
<cr id="d4978ecd80126914b54f913ed5a5ce7d27fcb726a7ce81f194c071bf6a9966bf" state="working">
<title>let module checkout external projects source tree</title>
<reporter>sdevaux</reporter>
<creation>2024-03-06 18:35:52+01:00</creation>
<description></description>
<links>
<link name="parent">7bc74cc796c455a46d699ad91f6aca5b7c790f56a6a0968b4ecbce33efce9d25</link>
</links>
<cf v="null"/>
<cf v="sdevaux 2024-03-06T18:36:24+01:00"/>
</cr>
10 changes: 10 additions & 0 deletions core/module-crules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ include $(ABSROOT)/core/module-cheaders.mk

# object files : one for each c and cpp file.
COBJS+=$(patsubst src/%.c,$(OBJDIR)/%.o,$(filter-out $(patsubst %,src/%,$(DISABLE_SRC)),$(filter %.c,$(SRCFILES))))
#COBJS+=$(patsubst src/%.c,$(OBJDIR)/%.o,$(filter-out $(patsubst %,$(EXT_SRC_DIR)/%,$(DISABLE_SRC)),$(filter %.c,$(EXTSRCFILES))))
CPPOBJS+=$(patsubst src/%.cpp,$(OBJDIR)/%.o,$(filter-out $(patsubst %,src/%,$(DISABLE_SRC)),$(filter %.cpp,$(SRCFILES))))
CPPOBJS+=$(patsubst $(EXT_SRC_DIR)/%.cpp,$(OBJDIR)/%.o,$(filter-out $(patsubst %,$(EXT_SRC_DIR)/%,$(DISABLE_SRC)),$(filter %.cpp,$(EXTSRCFILES))))
RESSRC:=$(filter src/embedded_lua/%.lua src/res/%,$(SRCFILES))
GENSRC+=$(patsubst src/%,$(OBJDIR)/%.c,$(RESSRC))
GENOBJS+=$(patsubst %.c,%.o,$(filter %.c,$(GENSRC)))
Expand Down Expand Up @@ -47,6 +49,10 @@ $(OBJDIR)/%.o: src/%.c
$(OBJDIR)/%.o: $(OBJDIR)/%.c
$(cc-command)

# external C file compilation
$(OBJDIR)/%.o: $(EXT_SRC_DIR)/%.c
$(cc-command)

# from idl generated cpp files compilation
$(OBJDIR)/idl/%.o: $(OBJDIR)/idl/%.cpp
$(CPPC) $(CFLAGS) -c $< -o $@
Expand All @@ -55,6 +61,10 @@ $(OBJDIR)/idl/%.o: $(OBJDIR)/idl/%.cpp
$(OBJDIR)/%.o: $(OBJDIR)/%.cpp
$(cxx-command)

# external cpp files compilation
$(OBJDIR)/%.o: $(EXT_SRC_DIR)/%.cpp
$(cxx-command)

# cpp files compilation
$(OBJDIR)/%.o: src/%.cpp
$(cxx-command)
Expand Down
19 changes: 19 additions & 0 deletions core/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ CC=
CPPC=
LD=
SPACECHAR=
## Path to receive external source files
EXT_SRC_DIR=$(BUILDROOT)/extsrc/


# Buildcript capabilities
Expand All @@ -31,6 +33,9 @@ BUILDSCRIPTS_CAPS:=linklib

# -L permit to get symbolic links too. Important for fileset module type.
SRCFILES:=$(shell find -L src -type f 2>/dev/null | grep -v "/\.")
EXTSRCFILES:=


# initialize variable that must not be forwared in recursive make call
COBJS:=
CPPOBJS:=
Expand Down Expand Up @@ -152,7 +157,21 @@ all-impl::
# ---------------------------------------------------------------------
CONFIGFILES:=$(patsubst %,$(TRDIR)/%,$(shell find etc -type f 2>/dev/null | grep -v "/.svn/"))

# ---------------------------------------------------------------------
# external sources / svn checkout
# ---------------------------------------------------------------------
# .....................................................................
# external sources / svn checkout
ifneq ($(SVN_CHECKOUTS),)

$(EXT_SRC_DIR)/svn/%/.mk:
@mkdir -p $(@D)
svn co $(word 2,$(subst =, ,$(filter $(patsubst $(EXT_SRC_DIR)/svn/%/.mk,%,$@)=%,$(SVN_CHECKOUTS)))) $(@D)
@echo 'EXTSRCFILES+=$$(shell find -L $(@D) -name "*.c" -o -name "*.cpp")' > $@

include $(foreach entry,$(SVN_CHECKOUTS),$(patsubst %,$(EXT_SRC_DIR)/svn/%/.mk,$(word 1,$(subst =, ,$(entry)))))

endif
# -------------------------------------------------
# module type adaptation
# -------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions sampleprj/cpplib/module.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
MODNAME=cpplib
MODTYPE=library
SVN_CHECKOUTS=\
plip/src=svn+ssh://moneta.eduvax.net/home/svn/cdev/medu/branches/0.1/util/src/ \
plip/include=svn+ssh://moneta.eduvax.net/home/svn/cdev/medu/branches/0.1/util/include/

CFLAGS+=-I$(EXT_SRC_DIR)/svn/plip/include

0 comments on commit c4ce7da

Please sign in to comment.