--- a/src/Makefile Tue Aug 28 13:45:22 2018 +0200 +++ b/src/Makefile Tue Aug 28 14:03:09 2018 +0200 @@ -36,26 +36,15 @@ SRC += client.c SRC += game.c -OBJ = $(SRC:%.c=../build/release/%$(OBJ_EXT)) -OBJ_D = $(SRC:%.c=../build/debug/%$(OBJ_EXT)) +OBJ = $(SRC:%.c=$(BUILDDIR)/%$(OBJ_EXT)) -all: ../build/release $(OBJ) - $(LD) -o ../build/release/$(BIN) $(OBJ) \ - ../build/release/chess$(LIB_EXT) $(LDFLAGS) - -debug: ../build/debug $(OBJ_D) - $(LD) -o ../build/debug/$(BIN) $(OBJ_D) \ - ../build/debug/chess$(LIB_EXT) $(LDFLAGS) +all: $(BUILDDIR) $(OBJ) + $(LD) -o $(BUILDDIR)/$(BIN) $(OBJ) \ + $(BUILDDIR)/chess$(LIB_EXT) $(LDFLAGS) -../build/release/%$(OBJ_EXT): %.c +$(BUILDDIR)/%$(OBJ_EXT): %.c $(CC) -o $@ $(CFLAGS) -c $< - -../build/debug/%$(OBJ_EXT): %.c - $(CC) -o $@ $(CFLAGS_D) -c $< -../build/release: - $(MKDIR) $(MKDIRFLAGS) ../build/release - -../build/debug: - $(MKDIR) $(MKDIRFLAGS) ../build/debug +$(BUILDDIR): + $(MKDIR) $(MKDIRFLAGS) $(BUILDDIR)