24 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
25 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 # POSSIBILITY OF SUCH DAMAGE. |
26 # POSSIBILITY OF SUCH DAMAGE. |
27 # |
27 # |
28 |
28 |
29 BUILDDIR = ../build |
29 include ../../conf.mk |
30 CONFIG = conf.mk |
|
31 |
|
32 include $(CONFIG) |
|
33 |
30 |
34 SRC += pawn.c |
31 SRC += pawn.c |
35 SRC += rook.c |
32 SRC += rook.c |
36 SRC += knight.c |
33 SRC += knight.c |
37 SRC += bishop.c |
34 SRC += bishop.c |
38 SRC += queen.c |
35 SRC += queen.c |
39 SRC += king.c |
36 SRC += king.c |
40 SRC += rules.c |
37 SRC += rules.c |
41 SRC += pgn.c |
38 SRC += pgn.c |
42 |
39 |
43 OBJ = $(SRC:%.c=$(BUILDDIR)/release/%$(OBJ_EXT)) |
40 OBJ = $(SRC:%.c=$(BUILDDIR)/%$(OBJ_EXT)) |
44 OBJ_D = $(SRC:%.c=$(BUILDDIR)/debug/%$(OBJ_EXT)) |
|
45 |
41 |
46 all: $(BUILDDIR)/release $(OBJ) |
42 all: $(BUILDDIR) $(OBJ) |
47 $(AR) $(ARFLAGS) $(BUILDDIR)/release/chess$(LIB_EXT) $(OBJ) |
43 $(AR) $(ARFLAGS) $(BUILDDIR)/chess$(LIB_EXT) $(OBJ) |
48 |
44 |
49 debug: $(BUILDDIR)/debug $(OBJ_D) |
45 $(BUILDDIR)/%$(OBJ_EXT): %.c |
50 $(AR) $(ARFLAGS) $(BUILDDIR)/debug/chess$(LIB_EXT) $(OBJ_D) |
|
51 |
|
52 $(BUILDDIR)/release/%$(OBJ_EXT): %.c |
|
53 $(CC) -o $@ $(CFLAGS) -c $< |
46 $(CC) -o $@ $(CFLAGS) -c $< |
54 |
47 |
55 $(BUILDDIR)/debug/%$(OBJ_EXT): %.c |
|
56 $(CC) -o $@ $(CFLAGS_D) -c $< |
|
57 |
|
58 $(BUILDDIR): |
48 $(BUILDDIR): |
59 $(MKDIR) $(MKDIRFLAGS) $(BUILDDIR) |
49 $(MKDIR) $(MKDIRFLAGS) $(BUILDDIR) |
60 |
50 |
61 clear: |
|
62 $(RM) $(RMFLAGS) $(BUILDDIR) |
|
63 |
|
64 $(BUILDDIR)/release: |
|
65 $(MKDIR) $(MKDIRFLAGS) $(BUILDDIR)/release |
|
66 |
|
67 $(BUILDDIR)/debug: |
|
68 $(MKDIR) $(MKDIRFLAGS) $(BUILDDIR)/debug |
|