-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakeFile
78 lines (44 loc) · 1.6 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Define variables for project directories and output
PROJECT1_DIR = SearchMethodsDemo
PROJECT2_DIR = BPlusTree-LinkedList-Complexity
OUTPUT_DIR = build
MAIN_CLASS_PROJECT1 = org.tuc.searchtest.SearchTests
MAIN_CLASS_PROJECT2 = org.tuc.console.MainConsole
# Define files required by project2
PROJECT2_FILES = BPlusTree-LinkedList-Complexity/1.txt BPlusTree-LinkedList-Complexity/2.txt
# Check if javac is available
CHECK_JAVAC := $(shell command -v javac 2> /dev/null)
ifeq ($(CHECK_JAVAC),)
$(error javac not found. Please install the JDK before running this Makefile.)
endif
# Build Project 1
build-project1:
@echo "Building Project 1..."
@mkdir -p $(OUTPUT_DIR)
@find $(PROJECT1_DIR)/src -name '*.java' | xargs javac -d $(OUTPUT_DIR)
@jar cfe $(OUTPUT_DIR)/project1.jar $(MAIN_CLASS_PROJECT1) -C $(OUTPUT_DIR) .
# Build Project 2
build-project2: prepare-project2-files
@echo "Building Project 2..."
@mkdir -p $(OUTPUT_DIR)
@find $(PROJECT2_DIR)/src -name '*.java' | xargs javac -d $(OUTPUT_DIR)
@jar cfe $(OUTPUT_DIR)/project2.jar $(MAIN_CLASS_PROJECT2) -C $(OUTPUT_DIR) .
# Prepare files required by Project 2
prepare-project2-files:
@echo "Preparing files for Project 2..."
@mkdir -p $(OUTPUT_DIR)
@cp $(PROJECT2_FILES) $(OUTPUT_DIR)
# Targets
all: help
project1: build-project1
project2: build-project2
clean:
@echo "Cleaning up..."
@rm -rf $(OUTPUT_DIR)
help:
@echo "Usage: make [target]"
@echo "Targets:"
@echo " project1 - Build Project 1"
@echo " project2 - Build Project 2"
@echo " clean - Clean the build directory"
@echo " help - Display this help message"