]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - Makefile
radiant: make rotate/scale dialogs non-modal
[xonotic/netradiant.git] / Makefile
index 8d827172295345ca3e1abe7e5bd451102990bf42..7bd232ccc2ecaf5632905af08c9cf86c79b89d49 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
 # user customizable stuf
 # you may override this in Makefile.conf or the environment
 BUILD              ?= debug
-# or: release
+# or: release, or: extradebug, or: profile
 OS                 ?= $(shell uname)
 # or: Linux, Win32, Darwin
 LDFLAGS            ?=
@@ -19,6 +19,7 @@ CXX                ?= g++
 RANLIB             ?= ranlib
 AR                 ?= ar
 LDD                ?= ldd # nothing on Win32
+WINDRES            ?= # only used on Win32
 
 PKGCONFIG          ?= pkg-config
 PKG_CONFIG_PATH    ?=
@@ -33,9 +34,13 @@ CP_R               ?= $(CP) -r
 RM                 ?= rm
 RM_R               ?= $(RM) -r
 TEE_STDERR         ?= | tee /dev/stderr
+TR                 ?= tr
 FIND               ?= find
 DIFF               ?= diff
 
+# optional:
+SVNVERSION         ?= svnversion
+
 STDOUT_TO_DEVNULL  ?= >/dev/null
 STDERR_TO_DEVNULL  ?= 2>/dev/null
 STDERR_TO_STDOUT   ?= 2>&1
@@ -99,6 +104,18 @@ ifeq ($(findstring $(CFLAGS),-g),)
 endif
        CPPFLAGS_COMMON += -D_DEBUG
        LDFLAGS_COMMON +=
+else ifeq ($(BUILD),profile)
+ifeq ($(findstring $(CFLAGS),-g),)
+       CFLAGS_COMMON += -g
+       # only add -g if no -g flag is in $(CFLAGS)
+endif
+ifeq ($(findstring $(CFLAGS),-O),)
+       CFLAGS_COMMON += -O
+       # only add -O if no -O flag is in $(CFLAGS)
+endif
+       CFLAGS_COMMON += -pg
+       CPPFLAGS_COMMON +=
+       LDFLAGS_COMMON += -pg
 else ifeq ($(BUILD),release)
 ifeq ($(findstring $(CFLAGS),-O),)
        CFLAGS_COMMON += -O3
@@ -146,6 +163,12 @@ endif
 RADIANT_VERSION = 1.5.0
 RADIANT_MAJOR_VERSION = 5
 RADIANT_MINOR_VERSION = 0
+
+SVN_VERSION := $(shell $(SVNVERSION) -n $(STDERR_TO_DEVNULL) | $(TR) -cd 0-9:)
+ifneq ($(SVN_VERSION),)
+       RADIANT_VERSION := $(RADIANT_VERSION)-svn$(SVN_VERSION)
+endif
+
 CPPFLAGS += -DRADIANT_VERSION="\"$(RADIANT_VERSION)\"" -DRADIANT_MAJOR_VERSION="\"$(RADIANT_MAJOR_VERSION)\"" -DRADIANT_MINOR_VERSION="\"$(RADIANT_MINOR_VERSION)\"" -DRADIANT_ABOUTMSG="\"$(RADIANT_ABOUTMSG)\""
 
 .PHONY: all
@@ -187,12 +210,14 @@ dependencies-check:
        checkbinary coreutils "$(RM)"; \
        checkbinary coreutils "$(RM_R)"; \
        checkbinary coreutils "$(ECHO) test $(TEE_STDERR)"; \
+       checkbinary coreutils "$(TR)"; \
        checkbinary findutils "$(FIND)"; \
        checkbinary diff "$(DIFF)"; \
        checkbinary gcc "$(CC)"; \
        checkbinary g++ "$(CXX)"; \
        checkbinary binutils "$(RANLIB)"; \
        checkbinary binutils "$(AR)"; \
+       [ "$(OS)" = "Win32" ] && checkbinary mingw32 "$(WINDRES)"; \
        [ "$(OS)" != "Win32" ] && checkbinary libc6 "$(LDD)"; \
        $(ECHO) All required tools have been found!
        @$(ECHO)
@@ -260,6 +285,7 @@ binaries: \
 clean:
        $(RM_R) install/
        $(FIND) . \( -name \*.o -o -name \*.d -o -name \*.$(DLL) -o -name \*.$(A) -o -name \*.$(EXE) \) -exec $(RM) {} \;
+       $(RM) icons/*.rc
 
 %.$(EXE):
        file=$@; $(MKDIR) $${file%/*}
@@ -275,6 +301,14 @@ clean:
        $(CXX) $^ $(LDFLAGS) $(LDFLAGS_COMMON) $(LDFLAGS_EXTRA) $(LDFLAGS_DLL) $(LIBS_EXTRA) $(LIBS_COMMON) $(LIBS) -shared -o $@
        [ -z "$(LDD)" ] || [ -z "`$(LDD) -r $@ $(STDERR_TO_STDOUT) $(STDOUT_TO_DEVNULL) $(TEE_STDERR)`" ] || { $(RM) $@; exit 1; }
 
+%.rc: %.ico
+       $(ECHO) '1 ICON "$<"' > $@
+
+ifeq ($(OS),Win32)
+%.o: %.rc
+       $(WINDRES) $< $@
+endif
+
 %.o: %.cpp $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),)
        $(CXX) $< $(CFLAGS) $(CXXFLAGS) $(CFLAGS_COMMON) $(CXXFLAGS_COMMON) $(CPPFLAGS) $(CPPFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(TARGET_ARCH) -c -o $@
 
@@ -336,6 +370,7 @@ install/q3map2.$(EXE): \
        libl_net.$(A) \
        libmathlib.$(A) \
        libpicomodel.$(A) \
+       $(if $(findstring $(OS),Win32),icons/q3map2.o,) \
 
 libmathlib.$(A): CPPFLAGS_EXTRA := -Ilibs
 libmathlib.$(A): \
@@ -430,6 +465,7 @@ install/q3data.$(EXE): \
        tools/quake3/q3data/video.o \
        libl_net.$(A) \
        libmathlib.$(A) \
+       $(if $(findstring $(OS),Win32),icons/q3data.o,) \
 
 install/radiant.$(EXE): LDFLAGS_EXTRA := $(MWINDOWS)
 install/radiant.$(EXE): LIBS_EXTRA := $(LIBS_GL) $(LIBS_DL) $(LIBS_XML) $(LIBS_GLIB) $(LIBS_GTK) $(LIBS_GTKGLEXT)
@@ -522,6 +558,7 @@ install/radiant.$(EXE): \
        libmathlib.$(A) \
        libprofile.$(A) \
        libxmllib.$(A) \
+       $(if $(findstring $(OS),Win32),icons/radiant.o,) \
 
 libcmdlib.$(A): CPPFLAGS_EXTRA := -Ilibs
 libcmdlib.$(A): \
@@ -762,6 +799,7 @@ install/qdata3.$(EXE): \
        tools/quake2/qdata/tables.o \
        tools/quake2/qdata/video.o \
        libl_net.$(A) \
+       $(if $(findstring $(OS),Win32),icons/qdata3.o,) \
 
 install/q2map.$(EXE): LIBS_EXTRA := $(LIBS_XML)
 install/q2map.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/quake2/common -Ilibs -Iinclude
@@ -799,6 +837,7 @@ install/q2map.$(EXE): \
        tools/quake2/q2map/tree.o \
        tools/quake2/q2map/writebsp.o \
        libl_net.$(A) \
+       $(if $(findstring $(OS),Win32),icons/q2map.o,) \
 
 install/plugins/ufoaiplug.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
 install/plugins/ufoaiplug.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
@@ -849,6 +888,7 @@ install/heretic2/h2data.$(EXE): \
        tools/quake2/qdata_heretic2/tmix.o \
        tools/quake2/qdata_heretic2/video.o \
        libl_net.$(A) \
+       $(if $(findstring $(OS),Win32),icons/h2data.o,) \
 
 .PHONY: install-data
 install-data: binaries