Callback: work at any arity
[xonotic/netradiant.git] / Makefile
index 1d9f068..0a2d4b9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,8 @@ CAT                ?= cat
 MKDIR              ?= mkdir -p
 CP                 ?= cp
 CP_R               ?= $(CP) -r
+LN                 ?= ln
+LN_SNF             ?= $(LN) -snf
 RM                 ?= rm
 RM_R               ?= $(RM) -r
 TEE_STDERR         ?= | tee /dev/stderr
@@ -79,7 +81,9 @@ LIBS_GL            ?= -lGL # -lopengl32 on Win32
 CPPFLAGS_DL        ?=
 LIBS_DL            ?= -ldl # nothing on Win32
 CPPFLAGS_ZLIB      ?=
-LIBS_ZLIB          ?= -lz
+LIBS_ZLIB          ?= -lz -lminizip
+CPPFLAGS_JPEG      ?=
+LIBS_JPEG          ?= -ljpeg
 DEPEND_ON_MAKEFILE ?= yes
 DOWNLOAD_GAMEPACKS ?= yes
 # set to no to disable gamepack, set to all to even download undistributable gamepacks
@@ -95,6 +99,7 @@ endif
 # these are used on Win32 only
 GTKDIR             ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtk+-2.0 --variable=prefix $(STDERR_TO_DEVNULL))
 WHICHDLL           ?= which
+DLLINSTALL         ?= install-dlls.sh
 
 # alias mingw32 OSes
 ifeq ($(OS),MINGW32_NT-6.0)
@@ -108,7 +113,7 @@ CFLAGS_COMMON = -MMD -W -Wall -Wcast-align -Wcast-qual -Wno-unused-parameter -fn
 CPPFLAGS_COMMON =
 LDFLAGS_COMMON =
 LIBS_COMMON =
-CXXFLAGS_COMMON = -Wno-non-virtual-dtor -Wreorder -fno-exceptions -fno-rtti
+CXXFLAGS_COMMON = -std=c++11 -Wno-non-virtual-dtor -Wreorder -fno-exceptions -fno-rtti
 
 ifeq ($(BUILD),debug)
 ifeq ($(findstring $(CFLAGS),-g),)
@@ -150,26 +155,39 @@ ifeq ($(BUILD),release)
 ifeq ($(findstring $(CFLAGS),-O),)
        CFLAGS_COMMON += -O3
        # only add -O3 if no -O flag is in $(CFLAGS)
-       # to allow overriding the optimizations
 endif
        CPPFLAGS_COMMON +=
        LDFLAGS_COMMON += -s
 else
 
+ifeq ($(BUILD),native)
+ifeq ($(findstring $(CFLAGS),-O),)
+       CFLAGS_COMMON += -O3
+       # only add -O3 if no -O flag is in $(CFLAGS)
+endif
+       CFLAGS_COMMON += -march=native -mcpu=native
+       CPPFLAGS_COMMON +=
+       LDFLAGS_COMMON += -s
+else
+
 $(error Unsupported build type: $(BUILD))
 endif
 endif
 endif
 endif
+endif
 
 INSTALLDIR_BASE := $(INSTALLDIR)
 
+MAKE_EXE_SYMLINK = false
+
 ifeq ($(OS),Linux)
        CPPFLAGS_COMMON += -DPOSIX -DXWINDOWS
        CFLAGS_COMMON += -fPIC
        LDFLAGS_DLL = -fPIC -ldl
        LIBS_COMMON = -lpthread
-       EXE ?= x86
+       EXE ?= $(shell uname -m)
+       MAKE_EXE_SYMLINK = true
        A = a
        DLL = so
        MWINDOWS =
@@ -178,8 +196,8 @@ else
 ifeq ($(OS),Win32)
        CPPFLAGS_COMMON += -DWIN32 -D_WIN32 -D_inline=inline
        CFLAGS_COMMON += -mms-bitfields
-       LDFLAGS_DLL = --dll -Wl,--add-stdcall-alias
-       LIBS_COMMON = -lws2_32 -luser32 -lgdi32
+       LDFLAGS_DLL = -Wl,--add-stdcall-alias
+       LIBS_COMMON = -lws2_32 -luser32 -lgdi32 -lole32
        EXE ?= exe
        A = a
        DLL = dll
@@ -197,11 +215,12 @@ ifeq ($(OS),Darwin)
        CPPFLAGS_COMMON += -DPOSIX -DXWINDOWS
        CFLAGS_COMMON += -fPIC
        CXXFLAGS_COMMON += -fno-exceptions -fno-rtti
-       CPPFLAGS_COMMON += -I/opt/local/include -I/sw/include -I/usr/X11R6/include
-       LDFLAGS_COMMON += -L/opt/local/lib -L/sw/lib -L/usr/X11R6/lib
-       LDFLAGS_DLL += -dynamiclib -ldl
-       EXE ?= ppc
        MACLIBDIR ?= /opt/local/lib
+       CPPFLAGS_COMMON += -I$(MACLIBDIR)/../include -I/usr/X11R6/include
+       LDFLAGS_COMMON += -L$(MACLIBDIR) -L/usr/X11R6/lib
+       LDFLAGS_DLL += -dynamiclib -ldl
+       EXE ?= $(shell uname -m)
+       MAKE_EXE_SYMLINK = true
        A = a
        DLL = dylib
        MWINDOWS =
@@ -214,8 +233,6 @@ ifeq ($(OS),Darwin)
        # workaround: we have no "ldd" for OS X, so...
        LDD =
        OTOOL = otool
-
-       INSTALLDIR := $(INSTALLDIR_BASE)/NetRadiant.app/Contents/MacOS/install
 else
 
 $(error Unsupported build OS: $(OS))
@@ -224,10 +241,11 @@ endif
 endif
 
 # VERSION!
-RADIANT_VERSION_NUMBER = 1.5.0
+RADIANT_MAJOR_VERSION = 1
+RADIANT_MINOR_VERSION = 5
+RADIANT_PATCH_VERSION = 0
+RADIANT_VERSION_NUMBER = $(RADIANT_MAJOR_VERSION).$(RADIANT_MINOR_VERSION).$(RADIANT_PATCH_VERSION)
 RADIANT_VERSION = $(RADIANT_VERSION_NUMBER)n
-RADIANT_MAJOR_VERSION = 5
-RADIANT_MINOR_VERSION = 0
 Q3MAP_VERSION = 2.5.17n
 
 # Executable extension
@@ -239,7 +257,8 @@ ifneq ($(GIT_VERSION),)
        Q3MAP_VERSION := $(Q3MAP_VERSION)-git-$(GIT_VERSION)
 endif
 
-CPPFLAGS += -DRADIANT_VERSION="\"$(RADIANT_VERSION)\"" -DRADIANT_MAJOR_VERSION="\"$(RADIANT_MAJOR_VERSION)\"" -DRADIANT_MINOR_VERSION="\"$(RADIANT_MINOR_VERSION)\"" -DRADIANT_ABOUTMSG="\"$(RADIANT_ABOUTMSG)\"" -DQ3MAP_VERSION="\"$(Q3MAP_VERSION)\"" -DRADIANT_EXECUTABLE="\"$(RADIANT_EXECUTABLE)\""
+CPPFLAGS += -DRADIANT_VERSION="\"$(RADIANT_VERSION)\"" -DRADIANT_MAJOR_VERSION="\"$(RADIANT_MAJOR_VERSION)\"" -DRADIANT_MINOR_VERSION="\"$(RADIANT_MINOR_VERSION)\"" -DRADIANT_PATCH_VERSION="\"$(RADIANT_PATCH_VERSION)\"" -DRADIANT_ABOUTMSG="\"$(RADIANT_ABOUTMSG)\"" -DQ3MAP_VERSION="\"$(Q3MAP_VERSION)\"" -DRADIANT_EXECUTABLE="\"$(RADIANT_EXECUTABLE)\""
+CPPFLAGS += -DGTK_TARGET=2
 
 .PHONY: all
 all: \
@@ -328,7 +347,8 @@ dependencies-check:
                fi; \
        }; \
        $(ECHO) checking that the dependencies exist; \
-       checkheader libglib2.0-dev glib/gutils.h g_path_is_absolute "$(CPPFLAGS_GLIB)" "$(LIBS_GLIB)"; \
+       checkheader libjpeg8-dev jpeglib.h jpeg_set_defaults "$(CPPFLAGS_JPEG)" "$(LIBS_JPEG)"; \
+       checkheader libglib2.0-dev glib.h g_path_is_absolute "$(CPPFLAGS_GLIB)" "$(LIBS_GLIB)"; \
        checkheader libxml2-dev libxml/xpath.h xmlXPathInit "$(CPPFLAGS_XML)" "$(LIBS_XML)"; \
        checkheader libpng12-dev png.h png_create_read_struct "$(CPPFLAGS_PNG)" "$(LIBS_PNG)"; \
        checkheader "mesa-common-dev (or another OpenGL library)" GL/gl.h glClear "$(CPPFLAGS_GL)" "$(LIBS_GL)"; \
@@ -343,7 +363,17 @@ endif
 
 .PHONY: binaries
 binaries: \
-       $(INSTALLDIR)/heretic2/h2data.$(EXE) \
+       binaries-tools \
+       binaries-radiant \
+
+.PHONY: binaries-radiant-all
+binaries-radiant: \
+       binaries-radiant-modules \
+       binaries-radiant-plugins \
+       binaries-radiant-core \
+
+.PHONY: binaries-radiant-modules
+binaries-radiant-modules: \
        $(INSTALLDIR)/modules/archivepak.$(DLL) \
        $(INSTALLDIR)/modules/archivewad.$(DLL) \
        $(INSTALLDIR)/modules/archivezip.$(DLL) \
@@ -358,17 +388,62 @@ binaries: \
        $(INSTALLDIR)/modules/model.$(DLL) \
        $(INSTALLDIR)/modules/shaders.$(DLL) \
        $(INSTALLDIR)/modules/vfspk3.$(DLL) \
+
+.PHONY: binaries-radiant-plugins
+binaries-radiant-plugins: \
        $(INSTALLDIR)/plugins/bobtoolz.$(DLL) \
        $(INSTALLDIR)/plugins/brushexport.$(DLL) \
        $(INSTALLDIR)/plugins/prtview.$(DLL) \
        $(INSTALLDIR)/plugins/shaderplug.$(DLL) \
        $(INSTALLDIR)/plugins/sunplug.$(DLL) \
        $(INSTALLDIR)/plugins/ufoaiplug.$(DLL) \
+
+.PHONY: binaries-radiant
+binaries-radiant-core: \
+       $(INSTALLDIR)/radiant.$(EXE) \
+       $(INSTALLDIR)/radiant \
+
+.PHONY: binaries-tools
+binaries-tools: \
+       binaries-tools-quake2 \
+       binaries-tools-quake3 \
+
+.PHONY: binaries-tools-quake2
+binaries-tools-quake2: \
+       binaries-q2map \
+       binaries-qdata3 \
+       binaries-h2data \
+
+.PHONY: binaries-q2map
+binaries-q2map: \
        $(INSTALLDIR)/q2map.$(EXE) \
+       $(INSTALLDIR)/q2map \
+
+.PHONY: binaries-qdata3
+binaries-qdata3: \
+       $(INSTALLDIR)/qdata3.$(EXE) \
+       $(INSTALLDIR)/qdata3 \
+
+.PHONY: binaries-h2data
+binaries-h2data: \
+       $(INSTALLDIR)/heretic2/h2data.$(EXE) \
+       $(INSTALLDIR)/heretic2/h2data \
+
+.PHONY: binaries-tools-quake3
+binaries-tools-quake3: \
+       binaries-q3data \
+       binaries-q3map2 \
+
+.PHONY: binaries-q3data
+binaries-q3data: \
        $(INSTALLDIR)/q3data.$(EXE) \
+       $(INSTALLDIR)/q3data \
+
+.PHONY: binaries-q3map2
+binaries-q3map2: \
        $(INSTALLDIR)/q3map2.$(EXE) \
-       $(INSTALLDIR)/qdata3.$(EXE) \
-       $(INSTALLDIR)/radiant.$(EXE) \
+       $(INSTALLDIR)/q3map2 \
+
 
 .PHONY: clean
 clean:
@@ -381,6 +456,9 @@ clean:
        $(CXX) $^ $(LDFLAGS) $(LDFLAGS_COMMON) $(LDFLAGS_EXTRA) $(LIBS_EXTRA) $(LIBS_COMMON) $(LIBS) -o $@
        [ -z "$(LDD)" ] || [ -z "`$(LDD) -r $@ $(STDERR_TO_STDOUT) $(STDOUT_TO_DEVNULL) $(TEE_STDERR)`" ] || { $(RM) $@; exit 1; }
 
+$(INSTALLDIR)/%: $(INSTALLDIR)/%.$(EXE)
+       if $(MAKE_EXE_SYMLINK); then o=$<; $(LN_SNF) $${o##*/} $@; else true; fi
+
 %.$(A):
        $(AR) rc $@ $^
        $(RANLIB) $@
@@ -398,25 +476,25 @@ ifeq ($(OS),Win32)
        $(WINDRES) $< $@
 endif
 
-%.o: %.cpp $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),)
+%.o: %.cpp $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),) | dependencies-check
        $(CXX) $< $(CFLAGS) $(CXXFLAGS) $(CFLAGS_COMMON) $(CXXFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(CPPFLAGS_COMMON) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@
 
-%.o: %.c $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),)
+%.o: %.c $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),) | dependencies-check
        $(CC) $< $(CFLAGS) $(CFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(CPPFLAGS_COMMON) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@
 
 
-$(INSTALLDIR)/q3map2.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_PNG) $(LIBS_ZLIB)
-$(INSTALLDIR)/q3map2.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) -Itools/quake3/common -Ilibs -Iinclude
+$(INSTALLDIR)/q3map2.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_PNG) $(LIBS_JPEG) $(LIBS_ZLIB)
+$(INSTALLDIR)/q3map2.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) $(CPPFLAGS_JPEG) -Itools/quake3/common -Ilibs -Iinclude
 $(INSTALLDIR)/q3map2.$(EXE): \
        tools/quake3/common/cmdlib.o \
        tools/quake3/common/imagelib.o \
        tools/quake3/common/inout.o \
+       tools/quake3/common/jpeg.o \
        tools/quake3/common/md4.o \
        tools/quake3/common/mutex.o \
        tools/quake3/common/polylib.o \
        tools/quake3/common/scriplib.o \
        tools/quake3/common/threads.o \
-       tools/quake3/common/unzip.o \
        tools/quake3/common/vfs.o \
        tools/quake3/q3map2/brush.o \
        tools/quake3/q3map2/brush_primit.o \
@@ -424,11 +502,19 @@ $(INSTALLDIR)/q3map2.$(EXE): \
        tools/quake3/q3map2/bspfile_ibsp.o \
        tools/quake3/q3map2/bspfile_rbsp.o \
        tools/quake3/q3map2/bsp.o \
+       tools/quake3/q3map2/bsp_analyze.o \
+       tools/quake3/q3map2/bsp_scale.o \
+       tools/quake3/q3map2/bsp_info.o \
        tools/quake3/q3map2/convert_ase.o \
+       tools/quake3/q3map2/convert_bsp.o \
+       tools/quake3/q3map2/convert_obj.o \
        tools/quake3/q3map2/convert_map.o \
        tools/quake3/q3map2/decals.o \
+       tools/quake3/q3map2/exportents.o \
        tools/quake3/q3map2/facebsp.o \
+       tools/quake3/q3map2/fixaas.o \
        tools/quake3/q3map2/fog.o \
+       tools/quake3/q3map2/help.o \
        tools/quake3/q3map2/image.o \
        tools/quake3/q3map2/leakfile.o \
        tools/quake3/q3map2/light_bounce.o \
@@ -438,6 +524,7 @@ $(INSTALLDIR)/q3map2.$(EXE): \
        tools/quake3/q3map2/light_ydnar.o \
        tools/quake3/q3map2/main.o \
        tools/quake3/q3map2/map.o \
+       tools/quake3/q3map2/minimap.o \
        tools/quake3/q3map2/mesh.o \
        tools/quake3/q3map2/model.o \
        tools/quake3/q3map2/patch.o \
@@ -456,7 +543,8 @@ $(INSTALLDIR)/q3map2.$(EXE): \
        tools/quake3/q3map2/vis.o \
        tools/quake3/q3map2/writebsp.o \
        libddslib.$(A) \
-       libjpeg6.$(A) \
+       libetclib.$(A) \
+       libfilematch.$(A) \
        libl_net.$(A) \
        libmathlib.$(A) \
        libpicomodel.$(A) \
@@ -475,31 +563,6 @@ libl_net.$(A): \
        libs/l_net/l_net.o \
        $(if $(findstring $(OS),Win32),libs/l_net/l_net_wins.o,libs/l_net/l_net_berkley.o) \
 
-libjpeg6.$(A): CPPFLAGS_EXTRA := -Ilibs/jpeg6 -Ilibs
-libjpeg6.$(A): \
-       libs/jpeg6/jcomapi.o \
-       libs/jpeg6/jdapimin.o \
-       libs/jpeg6/jdapistd.o \
-       libs/jpeg6/jdatasrc.o \
-       libs/jpeg6/jdcoefct.o \
-       libs/jpeg6/jdcolor.o \
-       libs/jpeg6/jddctmgr.o \
-       libs/jpeg6/jdhuff.o \
-       libs/jpeg6/jdinput.o \
-       libs/jpeg6/jdmainct.o \
-       libs/jpeg6/jdmarker.o \
-       libs/jpeg6/jdmaster.o \
-       libs/jpeg6/jdpostct.o \
-       libs/jpeg6/jdsample.o \
-       libs/jpeg6/jdtrans.o \
-       libs/jpeg6/jerror.o \
-       libs/jpeg6/jfdctflt.o \
-       libs/jpeg6/jidctflt.o \
-       libs/jpeg6/jmemmgr.o \
-       libs/jpeg6/jmemnobs.o \
-       libs/jpeg6/jpgload.o \
-       libs/jpeg6/jutils.o \
-
 libpicomodel.$(A): CPPFLAGS_EXTRA := -Ilibs
 libpicomodel.$(A): \
        libs/picomodel/lwo/clip.o \
@@ -530,6 +593,10 @@ libddslib.$(A): CPPFLAGS_EXTRA := -Ilibs
 libddslib.$(A): \
        libs/ddslib/ddslib.o \
 
+libetclib.$(A): CPPFLAGS_EXTRA := -Ilibs
+libetclib.$(A): \
+       libs/etclib.o \
+
 $(INSTALLDIR)/q3data.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_ZLIB)
 $(INSTALLDIR)/q3data.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_ZLIB) -Itools/quake3/common -Ilibs -Iinclude
 $(INSTALLDIR)/q3data.$(EXE): \
@@ -541,7 +608,6 @@ $(INSTALLDIR)/q3data.$(EXE): \
        tools/quake3/common/md4.o \
        tools/quake3/common/scriplib.o \
        tools/quake3/common/trilib.o \
-       tools/quake3/common/unzip.o \
        tools/quake3/common/vfs.o \
        tools/quake3/q3data/3dslib.o \
        tools/quake3/q3data/compress.o \
@@ -553,6 +619,8 @@ $(INSTALLDIR)/q3data.$(EXE): \
        tools/quake3/q3data/q3data.o \
        tools/quake3/q3data/stripper.o \
        tools/quake3/q3data/video.o \
+       libfilematch.$(A) \
+       libetclib.$(A) \
        libl_net.$(A) \
        libmathlib.$(A) \
        $(if $(findstring $(OS),Win32),icons/q3data.o,) \
@@ -630,6 +698,7 @@ $(INSTALLDIR)/radiant.$(EXE): \
        radiant/stacktrace.o \
        radiant/surfacedialog.o \
        radiant/texmanip.o \
+       radiant/textureentry.o \
        radiant/textures.o \
        radiant/texwindow.o \
        radiant/timer.o \
@@ -644,12 +713,17 @@ $(INSTALLDIR)/radiant.$(EXE): \
        radiant/xywindow.o \
        libcmdlib.$(A) \
        libgtkutil.$(A) \
+       libuilib.$(A) \
        libl_net.$(A) \
        libmathlib.$(A) \
        libprofile.$(A) \
        libxmllib.$(A) \
        $(if $(findstring $(OS),Win32),icons/radiant.o,) \
 
+libfilematch.$(A): CPPFLAGS_EXTRA := -Ilibs
+libfilematch.$(A): \
+       libs/filematch.o \
+
 libcmdlib.$(A): CPPFLAGS_EXTRA := -Ilibs
 libcmdlib.$(A): \
        libs/cmdlib/cmdlib.o \
@@ -664,8 +738,6 @@ libgtkutil.$(A): \
        libs/gtkutil/accelerator.o \
        libs/gtkutil/button.o \
        libs/gtkutil/clipboard.o \
-       libs/gtkutil/closure.o \
-       libs/gtkutil/container.o \
        libs/gtkutil/cursor.o \
        libs/gtkutil/dialog.o \
        libs/gtkutil/entry.o \
@@ -673,51 +745,42 @@ libgtkutil.$(A): \
        libs/gtkutil/frame.o \
        libs/gtkutil/glfont.o \
        libs/gtkutil/glwidget.o \
-       libs/gtkutil/idledraw.o \
        libs/gtkutil/image.o \
        libs/gtkutil/menu.o \
        libs/gtkutil/messagebox.o \
        libs/gtkutil/nonmodal.o \
        libs/gtkutil/paned.o \
-       libs/gtkutil/pointer.o \
        libs/gtkutil/toolbar.o \
        libs/gtkutil/widget.o \
        libs/gtkutil/window.o \
        libs/gtkutil/xorrectangle.o \
 
+libuilib.$(A): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) -Ilibs -Iinclude
+libuilib.$(A): \
+       libs/uilib/uilib.o \
+
 libxmllib.$(A): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) -Ilibs -Iinclude
 libxmllib.$(A): \
-       libs/xml/ixml.o \
-       libs/xml/xmlelement.o \
-       libs/xml/xmlparser.o \
        libs/xml/xmltextags.o \
-       libs/xml/xmlwriter.o \
 
 $(INSTALLDIR)/modules/archivezip.$(DLL): LIBS_EXTRA := $(LIBS_ZLIB)
 $(INSTALLDIR)/modules/archivezip.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_ZLIB) -Ilibs -Iinclude
 $(INSTALLDIR)/modules/archivezip.$(DLL): \
        plugins/archivezip/archive.o \
-       plugins/archivezip/pkzip.o \
        plugins/archivezip/plugin.o \
-       plugins/archivezip/zlibstream.o \
 
 $(INSTALLDIR)/modules/archivewad.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
 $(INSTALLDIR)/modules/archivewad.$(DLL): \
        plugins/archivewad/archive.o \
        plugins/archivewad/plugin.o \
-       plugins/archivewad/wad.o \
 
 $(INSTALLDIR)/modules/archivepak.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
 $(INSTALLDIR)/modules/archivepak.$(DLL): \
        plugins/archivepak/archive.o \
-       plugins/archivepak/pak.o \
        plugins/archivepak/plugin.o \
 
-$(INSTALLDIR)/modules/entity.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
+$(INSTALLDIR)/modules/entity.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) -Ilibs -Iinclude
 $(INSTALLDIR)/modules/entity.$(DLL): \
-       plugins/entity/angle.o \
-       plugins/entity/angles.o \
-       plugins/entity/colour.o \
        plugins/entity/doom3group.o \
        plugins/entity/eclassmodel.o \
        plugins/entity/entity.o \
@@ -726,26 +789,22 @@ $(INSTALLDIR)/modules/entity.$(DLL): \
        plugins/entity/group.o \
        plugins/entity/light.o \
        plugins/entity/miscmodel.o \
-       plugins/entity/model.o \
-       plugins/entity/modelskinkey.o \
-       plugins/entity/namedentity.o \
-       plugins/entity/origin.o \
        plugins/entity/plugin.o \
-       plugins/entity/rotation.o \
-       plugins/entity/scale.o \
        plugins/entity/skincache.o \
        plugins/entity/targetable.o \
 
-$(INSTALLDIR)/modules/image.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
+$(INSTALLDIR)/modules/image.$(DLL): LIBS_EXTRA := $(LIBS_JPEG)
+$(INSTALLDIR)/modules/image.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_JPEG) -Ilibs -Iinclude
 $(INSTALLDIR)/modules/image.$(DLL): \
        plugins/image/bmp.o \
        plugins/image/dds.o \
        plugins/image/image.o \
        plugins/image/jpeg.o \
+       plugins/image/ktx.o \
        plugins/image/pcx.o \
        plugins/image/tga.o \
        libddslib.$(A) \
-       libjpeg6.$(A) \
+       libetclib.$(A) \
 
 $(INSTALLDIR)/modules/imageq2.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
 $(INSTALLDIR)/modules/imageq2.$(DLL): \
@@ -765,7 +824,7 @@ $(INSTALLDIR)/modules/imagepng.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_PNG) -Ilibs
 $(INSTALLDIR)/modules/imagepng.$(DLL): \
        plugins/imagepng/plugin.o \
 
-$(INSTALLDIR)/modules/mapq3.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
+$(INSTALLDIR)/modules/mapq3.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) -Ilibs -Iinclude
 $(INSTALLDIR)/modules/mapq3.$(DLL): \
        plugins/mapq3/parse.o \
        plugins/mapq3/plugin.o \
@@ -806,6 +865,7 @@ $(INSTALLDIR)/modules/vfspk3.$(DLL): \
        plugins/vfspk3/archive.o \
        plugins/vfspk3/vfs.o \
        plugins/vfspk3/vfspk3.o \
+       libfilematch.$(A) \
 
 $(INSTALLDIR)/plugins/bobtoolz.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
 $(INSTALLDIR)/plugins/bobtoolz.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
@@ -984,10 +1044,10 @@ $(INSTALLDIR)/heretic2/h2data.$(EXE): \
 install-data: binaries
        $(MKDIR) $(INSTALLDIR)/games
        $(FIND) $(INSTALLDIR_BASE)/ -name .svn -exec $(RM_R) {} \; -prune
-       [ "$(OS)" != "Darwin" ] || $(CP_R) setup/data/osx/NetRadiant.app/* $(INSTALLDIR_BASE)/NetRadiant.app/
        DOWNLOAD_GAMEPACKS="$(DOWNLOAD_GAMEPACKS)" GIT="$(GIT)" SVN="$(SVN)" WGET="$(WGET)" RM_R="$(RM_R)" MV="$(MV)" UNZIPPER="$(UNZIPPER)" ECHO="$(ECHO)" SH="$(SH)" CP="$(CP)" CP_R="$(CP_R)" $(SH) install-gamepacks.sh "$(INSTALLDIR)"
-       $(ECHO) $(RADIANT_MINOR_VERSION) > $(INSTALLDIR)/RADIANT_MINOR
        $(ECHO) $(RADIANT_MAJOR_VERSION) > $(INSTALLDIR)/RADIANT_MAJOR
+       $(ECHO) $(RADIANT_MINOR_VERSION) > $(INSTALLDIR)/RADIANT_MINOR
+       $(ECHO) $(RADIANT_PATCH_VERSION) > $(INSTALLDIR)/RADIANT_PATCH
        $(CP_R) setup/data/tools/* $(INSTALLDIR)/
        $(MKDIR) $(INSTALLDIR)/docs
        $(CP_R) docs/* $(INSTALLDIR)/docs/
@@ -996,16 +1056,11 @@ install-data: binaries
 .PHONY: install-dll
 ifeq ($(OS),Win32)
 install-dll: binaries
-       MKDIR="$(MKDIR)" CP="$(CP)" CAT="$(CAT)" GTKDIR="$(GTKDIR)" WHICHDLL="$(WHICHDLL)" INSTALLDIR="$(INSTALLDIR)" $(SH) install-dlls.sh
-else
-ifeq ($(OS),Darwin)
-install-dll: binaries
-       EXE="$(EXE)" MACLIBDIR="$(MACLIBDIR)" CP="$(CP)" OTOOL="$(OTOOL)" INSTALLDIR="$(INSTALLDIR)" $(SH) install-dylibs.sh
+       MKDIR="$(MKDIR)" CP="$(CP)" CAT="$(CAT)" GTKDIR="$(GTKDIR)" WHICHDLL="$(WHICHDLL)" INSTALLDIR="$(INSTALLDIR)" $(SH) $(DLLINSTALL) 
 else
 install-dll: binaries
        @$(ECHO) No DLL inclusion implemented for this target.
 endif
-endif
 
 # release building... NOT for general users
 # these may use tools not in the list that is checked by the build system
@@ -1019,6 +1074,7 @@ release-win32: INSTALLDIR := netradiant-$(RADIANT_VERSION_NUMBER)-$(BUILD_DATE)
 release-win32:
        $(MAKE) all INSTALLDIR=$(INSTALLDIR) MAKEFILE_CONF=cross-Makefile.conf RADIANT_ABOUTMSG="Official release build" BUILD=release
        7za a -sfx../../../../../../../../../../$(HOME)/7z.sfx ../$(INSTALLDIR)-win32-7z.exe $(INSTALLDIR)/
+       chmod 644 ../$(INSTALLDIR)-win32-7z.exe # 7zip is evil
        $(MAKE) clean INSTALLDIR=$(INSTALLDIR) MAKEFILE_CONF=cross-Makefile.conf RADIANT_ABOUTMSG="Official release build" BUILD=release
 
 release-all: