src/chess/Makefile

changeset 32
8a0b85303ee8
parent 20
fd1eb081de40
child 34
c4d4b8a8f902
--- a/src/chess/Makefile	Tue Apr 08 21:13:28 2014 +0200
+++ b/src/chess/Makefile	Wed Apr 09 09:34:07 2014 +0200
@@ -39,17 +39,29 @@
 SRC += king.c
 SRC += rules.c
 
-OBJ = $(SRC:%.c=$(BUILDDIR)/%$(OBJ_EXT))
+OBJ = $(SRC:%.c=$(BUILDDIR)/release/%$(OBJ_EXT))
+OBJ_D = $(SRC:%.c=$(BUILDDIR)/debug/%$(OBJ_EXT))
 
 all: $(OBJ)
-	$(AR) $(ARFLAGS) $(BUILDDIR)/chess$(LIB_EXT) $(OBJ)
-	
+	$(AR) $(ARFLAGS) $(BUILDDIR)/release/chess$(LIB_EXT) $(OBJ)
+
+debug: $(OBJ_D)
+	$(AR) $(ARFLAGS) $(BUILDDIR)/debug/chess$(LIB_EXT) $(OBJ_D)	
 
-$(BUILDDIR)/%$(OBJ_EXT): %.c
+$(BUILDDIR)/release/%$(OBJ_EXT): %.c $(BUILDDIR)/release
 	$(CC) -o $@ $(CFLAGS) -c $<
+	
+$(BUILDDIR)/debug/%$(OBJ_EXT): %.c $(BUILDDIR)/debug
+	$(CC) -o $@ $(CFLAGS_D) -c $<
 
 $(BUILDDIR):
 	$(MKDIR) $(MKDIRFLAGS) $(BUILDDIR)
 	
 clear:
 	$(RM) $(RMFLAGS) $(BUILDDIR)
+	
+ $(BUILDDIR)/release:
+	$(MKDIR) $(MKDIRFLAGS)  $(BUILDDIR)/release
+	
+ $(BUILDDIR)/debug:
+	$(MKDIR) $(MKDIRFLAGS)  $(BUILDDIR)/debug

mercurial