forked from phramos07/filesys
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (34 loc) · 1.01 KB
/
Makefile
File metadata and controls
42 lines (34 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Variables
JAVAC = javac
JAVA = java
SRC_DIR = .
BIN_DIR = bin
SRCS = $(shell find $(SRC_DIR) -name "*.java" -not -path "*/test/*" -not -path "*/tests/*")
CLASSES = $(SRCS:%.java=$(BIN_DIR)/%.class)
MAIN_CLASS = Main
# Default target
all: compile
# Create bin directory if it doesn't exist
$(BIN_DIR):
mkdir -p $(BIN_DIR)
# Compile all Java files (excluding tests)
compile: $(BIN_DIR) $(CLASSES)
# Pattern rule to compile Java files
$(BIN_DIR)/%.class: %.java
@mkdir -p $(dir $@)
$(JAVAC) -d $(BIN_DIR) $<
# Clean compiled files
clean:
rm -rf $(BIN_DIR)
# Run the application with a username
run: compile
$(JAVA) -cp $(BIN_DIR) $(MAIN_CLASS) -u $(USERNAME)
# Help target
help:
@echo "Targets disponíveis:"
@echo " all (padrão): Compila o projeto"
@echo " compile: Compila o projeto"
@echo " clean: Remove os arquivos .class compilados"
@echo " run USERNAME=username: Executa a aplicação com o nome de usuário especificado"
@echo " help: Exibe esta mensagem de ajuda"
.PHONY: all compile clean run help