-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
53 lines (43 loc) · 1.28 KB
/
makefile
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
43
44
45
46
47
48
49
50
51
52
53
# Variables
PROJECT_DIR := $(CURDIR)
SRC_DIR := $(PROJECT_DIR)/src/main/java/com/example/ParkingSimulator
MAIN_CLASS := com.example.ParkingSimulator.Main
JAR_FILE := target/ParkingSystem.jar
# Check if Maven is installed
MVN := $(shell command -v mvn 2> /dev/null)
# Check if Java is installed
JAVA := $(shell command -v java 2> /dev/null)
JAVAC := $(shell command -v javac 2> /dev/null)
# Default target
all: check-requirements compile package
# Check requirements
check-requirements:
ifndef MVN
@echo "Maven is not installed. Installing Maven..."
sudo apt-get update && sudo apt-get install -y maven
else
@echo "Maven is already installed."
endif
ifndef JAVA
@echo "Java is not installed. Installing Java..."
sudo apt-get update && sudo apt-get install -y default-jdk
else
@echo "Java is already installed."
endif
# Compile the project using Maven
compile:
@echo "Compiling the project..."
mvn clean compile
# Package the project into a JAR file
package: compile
@echo "Packaging the project..."
mvn package
# Clean target
clean:
@echo "Cleaning up..."
mvn clean
# Run the application
run: package
@echo "Running application..."
mvn javafx:run -DmainClass=$(MAIN_CLASS)
.PHONY: all check-requirements compile package clean run