--- 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 $< + +$(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 $< -FORCE: +$(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 $< +