Skip to content

Commit

Permalink
Atualizar a Makefile para uso no Windows
Browse files Browse the repository at this point in the history
Permite que a Makefile seja utiliza para a criação de um executável
independente no Windows.
Para isso é necessário a pasta do Allegro estar localizada no diretório
de compilação.
  • Loading branch information
OlavoNascimento committed Sep 7, 2019
1 parent cfd52d2 commit 0292dd3
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,36 @@ OBJ_DIR = obj
SRC_DIR = src
INC_DIR = include

# Windows Only
# Path to Allegro headers
ALLEGRO_INCLUDE_PATH = allegro/include
# Path to Allegro monolith library
ALLEGRO_MONOLITH_PATH = $(ALLEGRO_INCLUDE_PATH:include=lib/liballegro-5.0.10-monolith-mt.a)

EXE = GalaxyDefenders
SRC = $(wildcard $(SRC_DIR)/*.c)
OBJ = $(subst $(SRC_DIR), $(OBJ_DIR), $(SRC:.c=.o))

all: $(EXE)

$(EXE): $(OBJ)
ifeq ($(OS),Windows_NT)
@if not exist "$(BIN_DIR)" mkdir $(BIN_DIR)
$(CC) -mwindows -o $(BIN_DIR)/$@ $(OBJ) $(ALLEGRO_MONOLITH_PATH)
else
mkdir -p $(BIN_DIR)
$(CC) -I$(INC_DIR) -o $(BIN_DIR)/$@ $(OBJ) $(LDFLAGS)
$(CC) -I$(INC_DIR) $(LDFLAGS) -o $(BIN_DIR)/$@ $(OBJ)
endif

$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
ifeq ($(OS),Windows_NT)
@if not exist "$(OBJ_DIR)" mkdir $(OBJ_DIR)
$(CC) -I$(INC_DIR) -I $(ALLEGRO_INCLUDE_PATH) $(CFLAGS) -c $< -o $@
else
mkdir -p $(OBJ_DIR)
$(CC) -I$(INC_DIR) $(CFLAGS) -c $< -o $@

endif

clean:
$(RM) $(OBJ)

Expand Down

0 comments on commit 0292dd3

Please sign in to comment.