# HG changeset patch # User Mike Becker # Date 1696161402 -7200 # Node ID 7e58e0f74e506437c244a012b96d41a71132bcbb # Parent 0bdb910478cc1ab86288a152ec4d0aae8dfd81a7 improve Makefiles diff -r 0bdb910478cc -r 7e58e0f74e50 configure --- a/configure Sun Oct 01 12:53:35 2023 +0200 +++ b/configure Sun Oct 01 13:56:42 2023 +0200 @@ -328,7 +328,6 @@ cat >> "$TEMP_DIR/make.mk" << __EOF__ LIB_EXT = .a -OBJ_EXT = .o __EOF__ break diff -r 0bdb910478cc -r 7e58e0f74e50 make/cc.mk --- a/make/cc.mk Sun Oct 01 12:53:35 2023 +0200 +++ b/make/cc.mk Sun Oct 01 13:56:42 2023 +0200 @@ -6,6 +6,3 @@ DEBUG_CC_FLAGS = -g RELEASE_CC_FLAGS = -O3 -DNDEBUG LDFLAGS = - -SHLIB_CFLAGS = -fPIC -SHLIB_LDFLAGS = -shared \ No newline at end of file diff -r 0bdb910478cc -r 7e58e0f74e50 make/project.xml --- a/make/project.xml Sun Oct 01 12:53:35 2023 +0200 +++ b/make/project.xml Sun Oct 01 13:56:42 2023 +0200 @@ -5,10 +5,7 @@ c - -LIB_EXT = .a -OBJ_EXT = .o - + LIB_EXT = .a command -v mkdir diff -r 0bdb910478cc -r 7e58e0f74e50 src/Makefile --- a/src/Makefile Sun Oct 01 12:53:35 2023 +0200 +++ b/src/Makefile Sun Oct 01 13:56:42 2023 +0200 @@ -29,11 +29,9 @@ include ../config.mk SRC = main.c colors.c network.c input.c server.c client.c game.c - -OBJ = $(SRC:%.c=$(BUILDDIR)/%$(OBJ_EXT)) +OBJ = $(SRC:%.c=$(BUILDDIR)/%.o) all: $(BUILDDIR)/terminal-chess FORCE - @echo "Build complete." $(BUILDDIR)/terminal-chess: $(OBJ) $(BUILDDIR)/libchess$(LIB_EXT) $(CC) -o $@ $(LDFLAGS) $^ @@ -41,7 +39,37 @@ $(BUILDDIR)/libchess$(LIB_EXT): FORCE cd chess; $(MAKE) -$(BUILDDIR)/%$(OBJ_EXT): %.c +FORCE: + + +$(BUILDDIR)/client.o: client.c terminal-chess.h network.h chess/rules.h \ + input.h game.h chess/chess.h chess/rules.h chess/pawn.h chess/rook.h \ + chess/knight.h chess/bishop.h chess/queen.h chess/king.h chess/pgn.h $(CC) -o $@ $(CFLAGS) -c $< -FORCE: +$(BUILDDIR)/colors.o: colors.c colors.h + $(CC) -o $@ $(CFLAGS) -c $< + +$(BUILDDIR)/game.o: game.c game.h chess/chess.h chess/rules.h \ + chess/pawn.h chess/rook.h chess/knight.h chess/bishop.h chess/queen.h \ + chess/king.h chess/pgn.h terminal-chess.h network.h chess/rules.h \ + input.h colors.h + $(CC) -o $@ $(CFLAGS) -c $< + +$(BUILDDIR)/input.o: input.c input.h + $(CC) -o $@ $(CFLAGS) -c $< + +$(BUILDDIR)/main.o: main.c terminal-chess.h network.h chess/rules.h \ + game.h chess/chess.h chess/rules.h chess/pawn.h chess/rook.h \ + chess/knight.h chess/bishop.h chess/queen.h chess/king.h chess/pgn.h \ + input.h colors.h + $(CC) -o $@ $(CFLAGS) -c $< + +$(BUILDDIR)/network.o: network.c network.h + $(CC) -o $@ $(CFLAGS) -c $< + +$(BUILDDIR)/server.o: server.c terminal-chess.h network.h chess/rules.h \ + game.h chess/chess.h chess/rules.h chess/pawn.h chess/rook.h \ + chess/knight.h chess/bishop.h chess/queen.h chess/king.h chess/pgn.h + $(CC) -o $@ $(CFLAGS) -c $< + diff -r 0bdb910478cc -r 7e58e0f74e50 src/chess/Makefile --- a/src/chess/Makefile Sun Oct 01 12:53:35 2023 +0200 +++ b/src/chess/Makefile Sun Oct 01 13:56:42 2023 +0200 @@ -28,17 +28,37 @@ include ../../config.mk -SRC = pawn.c rook.c knight.c bishop.c queen.c king.c \ - rules.c pgn.c +SRC = pawn.c rook.c knight.c bishop.c queen.c king.c rules.c pgn.c +OBJ = $(SRC:%.c=$(BUILDDIR)/%.o) -OBJ = $(SRC:%.c=$(BUILDDIR)/%$(OBJ_EXT)) +all: $(BUILDDIR)/libchess$(LIB_EXT) FORCE -all: $(BUILDDIR) $(OBJ) - $(AR) $(ARFLAGS) $(BUILDDIR)/libchess$(LIB_EXT) $(OBJ) +$(BUILDDIR)/libchess$(LIB_EXT): $(OBJ) + $(AR) $(ARFLAGS) $@ $^ -$(BUILDDIR)/%$(OBJ_EXT): %.c +FORCE: + +$(BUILDDIR)/pawn.o: pawn.c pawn.h rules.h $(CC) -o $@ $(CFLAGS) -c $< - -$(BUILDDIR): - $(MKDIR) $(MKDIRFLAGS) $(BUILDDIR) - + +$(BUILDDIR)/pgn.o: pgn.c pgn.h rules.h + $(CC) -o $@ $(CFLAGS) -c $< + +$(BUILDDIR)/rules.o: rules.c rules.h chess.h pawn.h rook.h \ + knight.h bishop.h queen.h king.h pgn.h + $(CC) -o $@ $(CFLAGS) -c $< + +$(BUILDDIR)/bishop.o: bishop.c bishop.h rules.h + $(CC) -o $@ $(CFLAGS) -c $< + +$(BUILDDIR)/knight.o: knight.c knight.h rules.h + $(CC) -o $@ $(CFLAGS) -c $< + +$(BUILDDIR)/queen.o: queen.c rules.h rook.h bishop.h queen.h + $(CC) -o $@ $(CFLAGS) -c $< + +$(BUILDDIR)/king.o: king.c rules.h king.h + $(CC) -o $@ $(CFLAGS) -c $< + +$(BUILDDIR)/rook.o: rook.c rules.h rook.h + $(CC) -o $@ $(CFLAGS) -c $< diff -r 0bdb910478cc -r 7e58e0f74e50 src/terminal-chess.h --- a/src/terminal-chess.h Sun Oct 01 12:53:35 2023 +0200 +++ b/src/terminal-chess.h Sun Oct 01 13:56:42 2023 +0200 @@ -36,7 +36,7 @@ #ifndef TERMINAL_CHESS_H #define TERMINAL_CHESS_H -#define PROGRAM_VERSION "0.9-r71" +#define PROGRAM_VERSION "0.9-r72" #ifdef __cplusplus extern "C" {