Commit 9e95d1ba authored by thomas's avatar thomas
Browse files

updated build system

git-svn-id: https://svn.grrrr.org/ext/trunk@956 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent 051b7f52
OUTNAME=$(NAME)
OUTNAME=$(NAME)
DEFS=$(DEFS) /DFLEXT_EXPORTS
OUTNAME=$(FLEXTNAME)
DEFS=$(DEFS) /DFLEXT_EXPORTS
OUTNAME=$(FLEXTNAME)
##############################################
# flext defines
##############################################
!ifdef SHARED
# --- shared ---
DEFS=$(DEFS) /DFLEXT_SHARED
!else
!ifdef THREADED
# --- static multi-threaded ---
DEFS=$(DEFS) /DFLEXT_THREADS
!else
# --- static single-threaded ---
!endif
!endif
##############################################
# name of flext library
##############################################
!ifdef SHARED
!ifdef DEBUG
FLEXTNAME=flext-$(RTSYS)_d
!else
FLEXTNAME=flext-$(RTSYS)
!endif
!else
!ifdef THREADED
!ifdef DEBUG
FLEXTNAME=flext-$(RTSYS)_td
!else
FLEXTNAME=flext-$(RTSYS)_t
!endif
!else
!ifdef DEBUG
FLEXTNAME=flext-$(RTSYS)_sd
!else
FLEXTNAME=flext-$(RTSYS)_s
!endif
!endif
!endif # SHARED
##############################################
# product name and folder
##############################################
!ifndef SRCDIR
SRCDIR=.
!endif
OUTNAME=$(NAME)
OUTSUB=$(TARGETMODE)-$(TARGETTYPE)
##############################################
# flext defines
##############################################
!ifdef SHARED
# --- shared ---
DEFS=$(DEFS) /DFLEXT_SHARED
!else
!ifdef THREADED
# --- static multi-threaded ---
DEFS=$(DEFS) /DFLEXT_THREADS
!else
# --- static single-threaded ---
!endif
!endif
##############################################
# name of flext library
##############################################
!ifdef SHARED
!ifdef DEBUG
FLEXTNAME=flext-$(RTSYS)_d
!else
FLEXTNAME=flext-$(RTSYS)
!endif
!else
!ifdef THREADED
!ifdef DEBUG
FLEXTNAME=flext-$(RTSYS)_td
!else
FLEXTNAME=flext-$(RTSYS)_t
!endif
!else
!ifdef DEBUG
FLEXTNAME=flext-$(RTSYS)_sd
!else
FLEXTNAME=flext-$(RTSYS)_s
!endif
!endif
!endif # SHARED
##############################################
# product name and folder
##############################################
!ifndef SRCDIR
SRCDIR=.
!endif
OUTNAME=$(NAME)
OUTSUB=$(TARGETMODE)-$(TARGETTYPE)
# build class specific settings
INCPATH += -I$(FLEXTINC)
LIBPATH += -L$(FLEXTLIB) -L$(FLEXTSHLIB)
LIBS += -l$(FLEXTNAME)
##############################################
# default target
_build_: $(TARGET)
$(CSRCS) $(CPPSRCS): $(patsubst %,$(SRCDIR)/%,$(HDRS))
touch $@
$(TARGETPATH):
mkdir -p $@
$(TARGETPATH)/%.opp : $(SRCDIR)/%.cpp
$(CXX) -c $(CFLAGS) $(DEFS) $(INCPATH) $< -o $@
$(TARGETPATH)/%.o : $(SRCDIR)/%.c
$(CC) -c $(CFLAGS) $(DEFS) $(INCPATH) $< -o $@
$(TARGET):: $(TARGETPATH)
$(TARGET):: $(COBJS) $(CPPOBJS)
$(CXX) $(LDFLAGS) $(LIBPATH) -o $@ $(COBJS) $(CPPOBJS) $(LIBS)
chmod 755 $@
strip --strip-unneeded $@
##############################################
_clean_:
rm $(COBJS) $(CPPOBJS) $(TARGET)
##############################################
$(INSTPATH):
-mkdir -p $@
_install_: $(INSTPATH)
install $(TARGET) $(INSTPATH)
# build class specific settings
INCPATH += -I$(FLEXTINC)
LIBPATH += -L$(FLEXTLIB) -L$(FLEXTSHLIB)
LIBS += -l$(FLEXTNAME)
##############################################
# default target
_build_: $(TARGET)
$(CSRCS) $(CPPSRCS): $(patsubst %,$(SRCDIR)/%,$(HDRS))
touch $@
$(TARGETPATH):
mkdir -p $@
$(TARGETPATH)/%.opp : $(SRCDIR)/%.cpp
$(CXX) -c $(CFLAGS) $(DEFS) $(INCPATH) $< -o $@
$(TARGETPATH)/%.o : $(SRCDIR)/%.c
$(CC) -c $(CFLAGS) $(DEFS) $(INCPATH) $< -o $@
$(TARGET):: $(TARGETPATH)
$(TARGET):: $(COBJS) $(CPPOBJS)
$(CXX) $(LDFLAGS) $(LIBPATH) -o $@ $(COBJS) $(CPPOBJS) $(LIBS)
chmod 755 $@
strip --strip-unneeded $@
##############################################
_clean_:
rm $(COBJS) $(CPPOBJS) $(TARGET)
##############################################
$(INSTPATH):
-mkdir -p $@
_install_: $(INSTPATH)
install $(TARGET) $(INSTPATH)
# build class specific settings
##############################################
# default target
_build_: $(TARGET)
$(CSRCS) $(CPPSRCS): $(patsubst %,$(SRCDIR)/%,$(HDRS))
touch $@
$(TARGETPATH):
-mkdir -p $@
$(TARGETPATH)/%.opp : $(SRCDIR)/%.cpp
$(CXX) -c $(CFLAGS) $(DEFS) $(INCPATH) $< -o $@
$(TARGETPATH)/%.o : $(SRCDIR)/%.c
$(CC) -c $(CFLAGS) $(DEFS) $(INCPATH) $< -o $@
$(TARGET) :: $(TARGETPATH)
$(TARGET) :: $(COBJS) $(CPPOBJS)
ifdef SHARED
$(CXX) $(LDFLAGS) $(LIBPATH) -o $@ $(COBJS) $(CPPOBJS) $(LIBS)
chmod 755 $@
strip --strip-unneeded $@
else
$(AR) rc $@ $(COBJS) $(CPPOBJS)
endif
##############################################
_clean_:
rm $(COBJS) $(CPPOBJS) $(TARGET)
##############################################
ifdef SHARED
FLEXTLIBINST=$(FLEXTSHLIB)
else
FLEXTLIBINST=$(FLEXTLIB)
endif
$(FLEXTINC):
-mkdir -p $@
$(FLEXTLIBINST):
-mkdir -p $@
_install_: $(FLEXTINC) $(FLEXTLIBINST)
install $(TARGET) $(FLEXTLIBINST)
install $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(FLEXTINC)
# build class specific settings
##############################################
# default target
_build_: $(TARGET)
$(CSRCS) $(CPPSRCS): $(patsubst %,$(SRCDIR)/%,$(HDRS))
touch $@
$(TARGETPATH):
-mkdir -p $@
$(TARGETPATH)/%.opp : $(SRCDIR)/%.cpp
$(CXX) -c $(CFLAGS) $(DEFS) $(INCPATH) $< -o $@
$(TARGETPATH)/%.o : $(SRCDIR)/%.c
$(CC) -c $(CFLAGS) $(DEFS) $(INCPATH) $< -o $@
$(TARGET) :: $(TARGETPATH)
$(TARGET) :: $(COBJS) $(CPPOBJS)
ifdef SHARED
$(CXX) $(LDFLAGS) $(LIBPATH) -o $@ $(COBJS) $(CPPOBJS) $(LIBS)
chmod 755 $@
strip --strip-unneeded $@
else
$(AR) rc $@ $(COBJS) $(CPPOBJS)
endif
##############################################
_clean_:
rm $(COBJS) $(CPPOBJS) $(TARGET)
##############################################
ifdef SHARED
FLEXTLIBINST=$(FLEXTSHLIB)
else
FLEXTLIBINST=$(FLEXTLIB)
endif
$(FLEXTINC):
-mkdir -p $@
$(FLEXTLIBINST):
-mkdir -p $@
_install_: $(FLEXTINC) $(FLEXTLIBINST)
install $(TARGET) $(FLEXTLIBINST)
install $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(FLEXTINC)
ifdef SHARED
EXT=so
else
EXT=a
endif
ifdef SHARED
EXT=so
else
EXT=a
endif
# build class specific settings
INCPATH += -I$(FLEXTINC)
LIBPATH += -L$(FLEXTLIB) -L$(FLEXTSHLIB)
LIBS += -l$(FLEXTNAME)
# obviously header precompilation os still buggy with gcc 3.3
ifdef PRECOMPILE
#PRECOMSRC=$(SRCDIR)/$(PRECOMPILE)
else
#PRECOMSRC=$(FLEXTINC)/flext.h
endif
ifdef PRECOMSRC
PRECOMDST=$(OBJPATH)/$(notdir $(PRECOMSRC)).gch
PRECOMINC = -include $(OBJPATH)/$(notdir $(PRECOMSRC))
endif
##############################################
CSRCS=$(patsubst %.c,$(SRCDIR)/%.c,$(filter %.c,$(SRCS)))
CPPSRCS=$(patsubst %.cpp,$(SRCDIR)/%.cpp,$(filter %.cpp,$(SRCS)))
COBJS=$(patsubst %.c,$(OBJPATH)/%.o,$(filter %.c,$(SRCS)))
CPPOBJS=$(patsubst %.cpp,$(OBJPATH)/%.opp,$(filter %.cpp,$(SRCS)))
##############################################
# default target
_build_: $(TARGET)
$(CSRCS) $(CPPSRCS): $(patsubst %,$(SRCDIR)/%,$(HDRS))
touch $@
# Attention: $@ doesn't work for paths with spaces....
$(OBJPATH):
-mkdir -p $(OBJPATH)
# Attention: $@ doesn't work for paths with spaces....
$(TARGETPATH):
-mkdir -p $(TARGETPATH)
$(PRECOMDST) : $(PRECOMSRC) $(patsubst %,$(SRCDIR)/%,$(HDRS))
$(CXX) -c $(CFLAGS) $(DEFS) $(INCPATH) $(PRECOMSRC) -o $@
$(OBJPATH)/%.opp : $(SRCDIR)/%.cpp
$(CXX) -c $(CFLAGS) $(DEFS) $(PRECOMINC) $(INCPATH) $< -o $@
$(OBJPATH)/%.o : $(SRCDIR)/%.c
$(CC) -c $(CFLAGS) $(DEFS) $(INCPATH) $< -o $@
$(TARGET) :: $(OBJPATH) $(TARGETPATH)
$(TARGET) :: $(PRECOMDST) $(COBJS) $(CPPOBJS)
$(CXX) $(LDFLAGS) $(LIBPATH) -o $@ $(COBJS) $(CPPOBJS) $(LIBS)
chmod 755 $@
##############################################
_clean_:
-rm -r $(TARGETPATH)
-rm -r $(OBJPATH)
##############################################
# Attention: $@ doesn't work for paths with spaces....
$(INSTPATH):
-mkdir -p $(INSTPATH)
_install_:: $(INSTPATH)
cp -R $(INSTTARGET) $(INSTPATH)
# build class specific settings
INCPATH += -I$(FLEXTINC)
LIBPATH += -L$(FLEXTLIB) -L$(FLEXTSHLIB)
LIBS += -l$(FLEXTNAME)
# obviously header precompilation os still buggy with gcc 3.3
ifdef PRECOMPILE
#PRECOMSRC=$(SRCDIR)/$(PRECOMPILE)
else
#PRECOMSRC=$(FLEXTINC)/flext.h
endif
ifdef PRECOMSRC
PRECOMDST=$(OBJPATH)/$(notdir $(PRECOMSRC)).gch
PRECOMINC = -include $(OBJPATH)/$(notdir $(PRECOMSRC))
endif
##############################################
CSRCS=$(patsubst %.c,$(SRCDIR)/%.c,$(filter %.c,$(SRCS)))
CPPSRCS=$(patsubst %.cpp,$(SRCDIR)/%.cpp,$(filter %.cpp,$(SRCS)))
COBJS=$(patsubst %.c,$(OBJPATH)/%.o,$(filter %.c,$(SRCS)))
CPPOBJS=$(patsubst %.cpp,$(OBJPATH)/%.opp,$(filter %.cpp,$(SRCS)))
##############################################
# default target
_build_: $(TARGET)
$(CSRCS) $(CPPSRCS): $(patsubst %,$(SRCDIR)/%,$(HDRS))
touch $@
# Attention: $@ doesn't work for paths with spaces....
$(OBJPATH):
-mkdir -p $(OBJPATH)
# Attention: $@ doesn't work for paths with spaces....
$(TARGETPATH):
-mkdir -p $(TARGETPATH)
$(PRECOMDST) : $(PRECOMSRC) $(patsubst %,$(SRCDIR)/%,$(HDRS))
$(CXX) -c $(CFLAGS) $(DEFS) $(INCPATH) $(PRECOMSRC) -o $@
$(OBJPATH)/%.opp : $(SRCDIR)/%.cpp
$(CXX) -c $(CFLAGS) $(DEFS) $(PRECOMINC) $(INCPATH) $< -o $@
$(OBJPATH)/%.o : $(SRCDIR)/%.c
$(CC) -c $(CFLAGS) $(DEFS) $(INCPATH) $< -o $@
$(TARGET) :: $(OBJPATH) $(TARGETPATH)
$(TARGET) :: $(PRECOMDST) $(COBJS) $(CPPOBJS)
$(CXX) $(LDFLAGS) $(LIBPATH) -o $@ $(COBJS) $(CPPOBJS) $(LIBS)
chmod 755 $@
##############################################
_clean_:
-rm -r $(TARGETPATH)
-rm -r $(OBJPATH)
##############################################
# Attention: $@ doesn't work for paths with spaces....
$(INSTPATH):
-mkdir -p $(INSTPATH)
_install_:: $(INSTPATH)
cp -R $(INSTTARGET) $(INSTPATH)
# build class specific settings
ifdef SHARED
#LDFLAGS += -dylib_install_name $(FLEXTSHLIB)/$(OUTNAME).$(EXT)
endif
##############################################
CSRCS=$(patsubst %.c,$(SRCDIR)/%.c,$(filter %.c,$(SRCS)))
CPPSRCS=$(patsubst %.cpp,$(SRCDIR)/%.cpp,$(filter %.cpp,$(SRCS)))
COBJS=$(patsubst %.c,$(OBJPATH)/%.o,$(filter %.c,$(SRCS)))
CPPOBJS=$(patsubst %.cpp,$(OBJPATH)/%.opp,$(filter %.cpp,$(SRCS)))
# default target
_build_: $(TARGET)
$(CSRCS) $(CPPSRCS): $(patsubst %,$(SRCDIR)/%,$(HDRS))
touch $@
$(OBJPATH):
-mkdir -p $@
$(TARGETPATH):
-mkdir -p $@
ifdef PRECOMPILE
PRECOMSRC=$(SRCDIR)/$(PRECOMPILE)
PRECOMDST=$(OBJPATH)/$(notdir $(PRECOMSRC)).gch
PRECOMINC = -include $(OBJPATH)/$(notdir $(PRECOMSRC))
endif
$(PRECOMDST): $(PRECOMSRC) $(patsubst %,$(SRCDIR)/%,$(HDRS))
$(CXX) -c $(CFLAGS) $(DEFS) $(INCPATH) $(PRECOMSRC) -o $@
$(OBJPATH)/%.opp : $(SRCDIR)/%.cpp
$(CXX) -c $(CFLAGS) $(DEFS) $(PRECOMINC) $(INCPATH) $< -o $@
$(OBJPATH)/%.o : $(SRCDIR)/%.c
$(CC) -c $(CFLAGS) $(DEFS) $(INCPATH) $< -o $@
$(TARGET) :: $(OBJPATH) $(TARGETPATH)
$(TARGET) :: $(PRECOMDST) $(COBJS) $(CPPOBJS)
ifdef SHARED
$(CXX) $(LDFLAGS) $(LIBPATH) -o $@ $(COBJS) $(CPPOBJS) $(LIBS)
chmod 755 $@
else
libtool -static -o $@ $(COBJS) $(CPPOBJS)
endif
##############################################
_clean_:
-rm -r $(TARGETPATH)
-rm -r $(OBJPATH)
##############################################
ifdef SHARED
FLEXTLIBINST=$(FLEXTSHLIB)
else
FLEXTLIBINST=$(FLEXTLIB)
endif
$(FLEXTINC):
-mkdir -p $@
$(FLEXTLIBINST):
-mkdir -p $@
_install_: $(FLEXTINC) $(FLEXTLIBINST)
install $(TARGET) $(FLEXTLIBINST)
ifndef SHARED
# have to rerun ranlib at install dir ?!
ranlib $(FLEXTLIBINST)/$(notdir $(TARGET))
endif
install $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(FLEXTINC)
# build class specific settings
ifdef SHARED
#LDFLAGS += -dylib_install_name $(FLEXTSHLIB)/$(OUTNAME).$(EXT)
endif
##############################################
CSRCS=$(patsubst %.c,$(SRCDIR)/%.c,$(filter %.c,$(SRCS)))
CPPSRCS=$(patsubst %.cpp,$(SRCDIR)/%.cpp,$(filter %.cpp,$(SRCS)))
COBJS=$(patsubst %.c,$(OBJPATH)/%.o,$(filter %.c,$(SRCS)))
CPPOBJS=$(patsubst %.cpp,$(OBJPATH)/%.opp,$(filter %.cpp,$(SRCS)))
# default target
_build_: $(TARGET)
$(CSRCS) $(CPPSRCS): $(patsubst %,$(SRCDIR)/%,$(HDRS))
touch $@
$(OBJPATH):
-mkdir -p $@
$(TARGETPATH):
-mkdir -p $@
ifdef PRECOMPILE
PRECOMSRC=$(SRCDIR)/$(PRECOMPILE)
PRECOMDST=$(OBJPATH)/$(notdir $(PRECOMSRC)).gch
PRECOMINC = -include $(OBJPATH)/$(notdir $(PRECOMSRC))
endif
$(PRECOMDST): $(PRECOMSRC) $(patsubst %,$(SRCDIR)/%,$(HDRS))
$(CXX) -c $(CFLAGS) $(DEFS) $(INCPATH) $(PRECOMSRC) -o $@
$(OBJPATH)/%.opp : $(SRCDIR)/%.cpp
$(CXX) -c $(CFLAGS) $(DEFS) $(PRECOMINC) $(INCPATH) $< -o $@