further improved build system (debug is now a target instead of a configuration)

Mon, 09 Sep 2013 10:48:08 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 09 Sep 2013 10:48:08 +0200
changeset 155
45395ba5ed30
parent 154
8346aebfbb7b
child 156
6a4bd1f4c57e

further improved build system (debug is now a target instead of a configuration)

Makefile file | annotate | diff | comparison | revisions
README file | annotate | diff | comparison | revisions
clang-debug.mk file | annotate | diff | comparison | revisions
clang.mk file | annotate | diff | comparison | revisions
g++-debug.mk file | annotate | diff | comparison | revisions
g++.mk file | annotate | diff | comparison | revisions
gcc-debug.mk file | annotate | diff | comparison | revisions
gcc.mk file | annotate | diff | comparison | revisions
osx-debug.mk file | annotate | diff | comparison | revisions
osx.mk file | annotate | diff | comparison | revisions
suncc-debug.mk file | annotate | diff | comparison | revisions
suncc.mk file | annotate | diff | comparison | revisions
test/Makefile file | annotate | diff | comparison | revisions
ucx/Makefile file | annotate | diff | comparison | revisions
unix.mk file | annotate | diff | comparison | revisions
windows.mk file | annotate | diff | comparison | revisions
--- a/Makefile	Fri Sep 06 17:01:53 2013 +0200
+++ b/Makefile	Mon Sep 09 10:48:08 2013 +0200
@@ -29,33 +29,43 @@
 
 #
 # available configurations:
-#   clang,   clang-debug
-#   gcc,     gcc-debug
-#   g++,     g++-debug
-#   osx,     osx-debug
-#   suncc,   suncc-debug
+#   clang
+#   gcc
+#   g++
+#   osx
+#   suncc
 #   windows
 #
 
 CONF=gcc
 PREFIX=/usr/local
 
-include unix.mk
 include $(CONF).mk
 
 all: ucx test
 
 ucx: FORCE
-	cd ucx; $(MAKE) CONF=$(CONF) all
+	cd ucx; $(MAKE) CONF=$(CONF)
+
+ucx-debug: FORCE
+	cd ucx; $(MAKE) CONF=$(CONF) debug
 	
 test: FORCE ucx
-	cd test; $(MAKE) CONF=$(CONF) all
+	cd test; $(MAKE) CONF=$(CONF)
+
+test-debug: FORCE ucx-debug
+	cd test; $(MAKE) CONF=$(CONF) debug
 
 run: FORCE test
-	./build/test$(APP_EXT)
+	./build/release/test/ucxtest$(APP_EXT)
+	
+run-debug: FORCE test-debug
+	./build/debug/test/ucxtest$(APP_EXT)
+	
+debug: ucx-debug test-debug
 
 install: ucx $(PREFIX)/lib $(PREFIX)/include/ucx
-	cp ./build/libucx$(LIB_EXT) $(PREFIX)/lib && \
+	cp ./build/release/libucx$(LIB_EXT) $(PREFIX)/lib && \
         cp ./ucx/*.h $(PREFIX)/include/ucx
 
 uninstall:
--- a/README	Fri Sep 06 17:01:53 2013 +0200
+++ b/README	Mon Sep 09 10:48:08 2013 +0200
@@ -5,10 +5,11 @@
 
 0. Table of Contents:
 
-  1. Introduction  ........................................................ 14
-  2. Build and Installation  .............................................. 24
-  3. Documentation  ....................................................... 57
-  4. Contact  ............................................................. 65
+  1. Introduction  ........................................................ 15
+  2. Build  ............................................................... 25
+  3. Install  ............................................................. 58
+  4. Documentation  ....................................................... 70
+  5. Contact  ............................................................. 78
 
 
 1. Introduction
@@ -16,30 +17,47 @@
 UAP Common eXtensions provide useful data structures and algorithms for common
 programmatic tasks in C language. By design the features are divided into
 modules to minimize the library footprint. Using the build files you can create
-a static lib containing all modules, but you might also want use the UCX sources
-in your project and compile against specific modules to further minimize the
-footprint. Feel free to do so.
+a static and a shared lib containing all modules, but you might also want use
+the UCX sources in your project and compile specific modules to further minimize
+the footprint. Feel free to do so.
 
 
-2. Build and Installation
+2. Build
 
 Untar the source archive and run
 
   make CONF=<yourconfig>
 
-If you are using gcc, then simply run
+If you are going to use gcc, then simply run
 
   make
 
-The available configurations are clang, clang-debug, gcc, gcc-debug, g++,
-g++-debug, osx, osx-debug, suncc, suncc-debug and windows. The later uses
-microsoft visual C++ compiler. If you want to use mingw oder cygwin, you can
-use the default gcc configuration.
+The available configurations are clang, gcc, g++, osx, suncc and windows. The
+later uses microsoft visual C++ compiler. If you want to use mingw oder cygwin,
+you can use the default gcc configuration.
 
 The build files are placed into a build subdirectory, which is created if it
 does not exists.
 
-To install UCX, run
+The default target builds an optimized binaries. Use the debug target by running
+
+  make debug CONF=<yourconfig>
+
+to disable optimization and enable debug symbols.
+
+If you want to test your build either run
+
+  make run CONF=<yourconfig>
+
+or
+
+  make run-debug CONF=<yourconfig>
+
+Again, you can omit the CONF parameter, when using the gcc.
+
+3. Install
+
+Build the binaries as described in chapter two. Then install UCX, by running
 
   make install
 
@@ -49,12 +67,7 @@
 
 The default prefix is /usr/local.
 
-If you want to test your build, run
-
-  make run CONF=<yourconfig>
-
-
-3. Documentation
+4. Documentation
 
 The code uses doxygen source code documentation. A html version of the
 documentation is also available here:
@@ -62,7 +75,7 @@
   http://develop.uap-core.de/ucx/1.0/index.html
 
 
-4. Contact
+5. Contact
 
 Copyright (c) 2013 Olaf Wintermann
 
--- a/clang-debug.mk	Fri Sep 06 17:01:53 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-CC = clang
-LD = clang
-
-CFLAGS  = -std=gnu99 -g -fstrict-aliasing -Wall -pedantic -c
-LDFLAGS = -lm
-
--- a/clang.mk	Fri Sep 06 17:01:53 2013 +0200
+++ b/clang.mk	Mon Sep 09 10:48:08 2013 +0200
@@ -26,9 +26,23 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-CC = clang
-LD = clang
+CC    = clang
+LD    = clang
+AR    = ar
+RM    = rm
+MKDIR = mkdir
 
-CFLAGS  = -std=gnu99 -O2 -fstrict-aliasing -c
-LDFLAGS = -lm
+CFLAGS     = -std=gnu99 -O2 -fstrict-aliasing -c
+CFLAGS_D   = -std=gnu99 -g -fstrict-aliasing -Wall -pedantic -c
+COFLAGS    = -o
+LDFLAGS    = -lm
+LDFLAGS_D  = -lm
+LOFLAGS    = -o
+ARFLAGS    = -r
+AOFLAGS    =
+RMFLAGS    = -f -R
+MKDIRFLAGS = -p
 
+OBJ_EXT = .o
+LIB_EXT = .a
+APP_EXT =
--- a/g++-debug.mk	Fri Sep 06 17:01:53 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-CC = g++
-LD = g++
-AR = ar
-RM = rm
-
-CFLAGS  = -std=gnu++0x -g -fstrict-aliasing -Wall -pedantic -c
-COFLAGS = -o
-LDFLAGS = 
-LOFLAGS = -o
-ARFLAGS = -r
-RMFLAGS = -f
-
-OBJ_EXT = o
-LIB_EXT = a
-APP_EXT =
--- a/g++.mk	Fri Sep 06 17:01:53 2013 +0200
+++ b/g++.mk	Mon Sep 09 10:48:08 2013 +0200
@@ -26,19 +26,23 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-CC = g++
-LD = g++
-AR = ar
-RM = rm
+CC    = g++
+LD    = g++
+AR    = ar
+RM    = rm
+MKDIR = mkdir
 
-CFLAGS  = -std=gnu++0x -O2 -fstrict-aliasing -c
-COFLAGS = -o
-LDFLAGS = 
-LOFLAGS = -o
-ARFLAGS = -r
-RMFLAGS = -f
+CFLAGS     = -std=gnu++0x -O2 -fstrict-aliasing -c
+CFLAGS_D   = -std=gnu++0x -g -fstrict-aliasing -Wall -pedantic -c
+COFLAGS    = -o
+LDFLAGS    = 
+LDFLAGS_D  = 
+LOFLAGS    = -o
+ARFLAGS    = -r
+AOFLAGS    =
+RMFLAGS    = -f -R
+MKDIRFLAGS = -p
 
-OBJ_EXT = o
-LIB_EXT = a
+OBJ_EXT = .o
+LIB_EXT = .a
 APP_EXT =
-
--- a/gcc-debug.mk	Fri Sep 06 17:01:53 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-CC = gcc
-LD = gcc
-
-CFLAGS  = -std=gnu99 -g -fstrict-aliasing -Wall -pedantic -c
-LDFLAGS = 
-
--- a/gcc.mk	Fri Sep 06 17:01:53 2013 +0200
+++ b/gcc.mk	Mon Sep 09 10:48:08 2013 +0200
@@ -26,9 +26,23 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-CC = gcc
-LD = gcc
+CC    = gcc
+LD    = gcc
+AR    = ar
+RM    = rm
+MKDIR = mkdir
 
-CFLAGS  = -std=gnu99 -O2 -fstrict-aliasing -c
-LDFLAGS = 
+CFLAGS     = -std=gnu99 -O2 -fstrict-aliasing -c
+CFLAGS_D   = -std=gnu99 -g -fstrict-aliasing -Wall -pedantic -c
+COFLAGS    = -o
+LDFLAGS    = 
+LDFLAGS_D  = 
+LOFLAGS    = -o
+ARFLAGS    = -r
+AOFLAGS    =
+RMFLAGS    = -f -R
+MKDIRFLAGS = -p
 
+OBJ_EXT = .o
+LIB_EXT = .a
+APP_EXT =
--- a/osx-debug.mk	Fri Sep 06 17:01:53 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-CC = cc
-LD = cc
-
-CFLAGS  = -g -c
-LDFLAGS = 
-
--- a/osx.mk	Fri Sep 06 17:01:53 2013 +0200
+++ b/osx.mk	Mon Sep 09 10:48:08 2013 +0200
@@ -26,9 +26,23 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-CC = cc
-LD = cc
+CC    = cc
+LD    = cc
+AR    = ar
+RM    = rm
+MKDIR = mkdir
 
-CFLAGS  = -O2 -c
-LDFLAGS = 
+CFLAGS     = -O2 -c
+CFLAGS_D   = -g -c
+COFLAGS    = -o
+LDFLAGS    = 
+LDFLAGS_D  = 
+LOFLAGS    = -o
+ARFLAGS    = -r
+AOFLAGS    =
+RMFLAGS    = -f -R
+MKDIRFLAGS = -p
 
+OBJ_EXT = .o
+LIB_EXT = .a
+APP_EXT =
--- a/suncc-debug.mk	Fri Sep 06 17:01:53 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-CC = cc
-LD = cc
-
-CFLAGS  = -g -c
-LDFLAGS = -lm
-
--- a/suncc.mk	Fri Sep 06 17:01:53 2013 +0200
+++ b/suncc.mk	Mon Sep 09 10:48:08 2013 +0200
@@ -26,9 +26,23 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-CC = cc
-LD = cc
+CC    = cc
+LD    = cc
+AR    = ar
+RM    = rm
+MKDIR = mkdir
 
-CFLAGS  = -O -c
-LDFLAGS = -lm
+CFLAGS     = -O -c
+CFLAGS_D   = -g -c
+COFLAGS    = -o
+LDFLAGS    = -lm
+LDFLAGS_D  = -lm
+LOFLAGS    = -o
+ARFLAGS    = -r
+AOFLAGS    =
+RMFLAGS    = -f -R
+MKDIRFLAGS = -p
 
+OBJ_EXT = .o
+LIB_EXT = .a
+APP_EXT =
--- a/test/Makefile	Fri Sep 06 17:01:53 2013 +0200
+++ b/test/Makefile	Mon Sep 09 10:48:08 2013 +0200
@@ -26,7 +26,6 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-include ../unix.mk
 include ../$(CONF).mk
 
 SRC  = main.c
@@ -39,16 +38,28 @@
 SRC += buffer_tests.c
 SRC += utils_tests.c
 
-OBJ = $(SRC:%.c=../build/%$(OBJ_EXT))
+OBJ   = $(SRC:%.c=../build/release/test/%$(OBJ_EXT))
+OBJ_D = $(SRC:%.c=../build/debug/test/%$(OBJ_EXT))
 
-all: ../build/ ../build/test
+all: ../build/release/test ../build/release/test/ucxtest$(APP_EXT)
+debug: ../build/debug/test ../build/debug/test/ucxtest$(APP_EXT)
 
-../build/test: $(OBJ)
-	$(LD) $(LDFLAGS) $(LOFLAGS)../build/test$(APP_EXT) $(OBJ) \
-		../build/libucx$(LIB_EXT)
+../build/release/test/ucxtest$(APP_EXT): $(OBJ)
+	$(LD) $(LDFLAGS) $(LOFLAGS)../build/release/test/ucxtest$(APP_EXT) \
+		$(OBJ) ../build/release/libucx$(LIB_EXT)
 
-../build/%$(OBJ_EXT): %.c
+../build/release/test/%$(OBJ_EXT): %.c
 	$(CC) $(CFLAGS) -I../ $(COFLAGS)$@ $<
 
-../build:
-	$(MKDIR) $(MKDIRFLAGS) ../build/test
+../build/release/test:
+	$(MKDIR) $(MKDIRFLAGS) ../build/release/test
+
+../build/debug/test/ucxtest$(APP_EXT): $(OBJ_D)
+	$(LD) $(LDFLAGS_D) $(LOFLAGS)../build/debug/test/ucxtest$(APP_EXT) \
+		$(OBJ_D) ../build/debug/libucx$(LIB_EXT)
+
+../build/debug/test/%$(OBJ_EXT): %.c
+	$(CC) $(CFLAGS_D) -I../ $(COFLAGS)$@ $<
+
+../build/debug/test:
+	$(MKDIR) $(MKDIRFLAGS) ../build/debug/test
--- a/ucx/Makefile	Fri Sep 06 17:01:53 2013 +0200
+++ b/ucx/Makefile	Mon Sep 09 10:48:08 2013 +0200
@@ -26,7 +26,6 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-include ../unix.mk
 include ../$(CONF).mk
 
 # list of source files
@@ -41,15 +40,26 @@
 SRC += logging.c
 SRC += buffer.c
 
-OBJ = $(SRC:%.c=../build/ucx/%$(OBJ_EXT))
-
-all: ../build/ucx ../build/libucx$(LIB_EXT)
+OBJ   = $(SRC:%.c=../build/release/ucx/%$(OBJ_EXT))
+OBJ_D = $(SRC:%.c=../build/debug/ucx/%$(OBJ_EXT))
 
-../build/libucx$(LIB_EXT): $(OBJ)
-	$(AR) $(ARFLAGS) $(AOFLAGS)../build/libucx$(LIB_EXT) $(OBJ)
+all: ../build/release/ucx ../build/release/libucx$(LIB_EXT)
+debug: ../build/debug/ucx ../build/debug/libucx$(LIB_EXT)
 
-../build/ucx/%$(OBJ_EXT): %.c
+../build/release/libucx$(LIB_EXT): $(OBJ)
+	$(AR) $(ARFLAGS) $(AOFLAGS)../build/release/libucx$(LIB_EXT) $(OBJ)
+
+../build/release/ucx/%$(OBJ_EXT): %.c
 	$(CC) $(CFLAGS) $(COFLAGS)$@ $<
 
-../build/ucx:
-	$(MKDIR) $(MKDIRFLAGS) ../build/ucx
+../build/release/ucx:
+	$(MKDIR) $(MKDIRFLAGS) ../build/release/ucx
+
+../build/debug/libucx$(LIB_EXT): $(OBJ_D)
+	$(AR) $(ARFLAGS) $(AOFLAGS)../build/debug/libucx$(LIB_EXT) $(OBJ_D)
+
+../build/debug/ucx/%$(OBJ_EXT): %.c
+	$(CC) $(CFLAGS_D) $(COFLAGS)$@ $<
+
+../build/debug/ucx:
+	$(MKDIR) $(MKDIRFLAGS) ../build/debug/ucx
--- a/unix.mk	Fri Sep 06 17:01:53 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-CC = @echo "\nInvalid configuration.\n" && /bin/false 
-LD = @echo "\nInvalid configuration.\n" && /bin/false 
-AR = ar
-RM = rm
-MKDIR = mkdir
-
-COFLAGS = -o ./
-LOFLAGS = -o ./
-ARFLAGS = -r
-RMFLAGS = -f -R
-MKDIRFLAGS = -p
-
-OBJ_EXT = .o
-LIB_EXT = .a
-APP_EXT =
-
--- a/windows.mk	Fri Sep 06 17:01:53 2013 +0200
+++ b/windows.mk	Mon Sep 09 10:48:08 2013 +0200
@@ -26,18 +26,23 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-CC = cl
-LD = link
-AR = lib
+CC    = cl
+LD    = link
+AR    = lib
+RM    = rm
+MKDIR = mkdir
 
-CFLAGS  = -c -TP -I../msc
-COFLAGS = -Fo
-LDFLAGS = 
-LOFLAGS = -OUT:
-ARFLAGS =
-AOFLAGS = -OUT:
+CFLAGS     = -c -TP -I../msc
+CFLAGS_D   = -c -TP -I../msc
+COFLAGS    = -Fo
+LDFLAGS    = 
+LDFLAGS_D  = 
+LOFLAGS    = -OUT:
+ARFLAGS    = 
+AOFLAGS    = -OUT:
+RMFLAGS    = -f -R
+MKDIRFLAGS = -p
 
 OBJ_EXT = .obj
 LIB_EXT = .lib
 APP_EXT = .exe
-

mercurial