-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (33 loc) · 1.12 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
PROJECT = $(shell basename $(CURDIR))
SRC_DIR = src
OUT_DIR = out
BINARY_DIR = $(OUT_DIR)/bin
LIBRARY_DIR = $(OUT_DIR)/lib
OUTPUT_BIN = $(BINARY_DIR)/$(PROJECT).exe
OUTPUT_LIB = $(LIBRARY_DIR)/$(PROJECT).dll
SOURCE_FILES = $(shell find $(SRC_DIR) -name "*.cs")
clean:
@echo "Cleaning output directory..."
@rm -rf $(OUT_DIR)
compile-bin: clean
@echo "Compiling source files to binary..."
@mkdir -p $(SRC_DIR) $(OUT_DIR) $(BINARY_DIR)
@mcs -out:$(OUTPUT_BIN) $(SOURCE_FILES)
@echo "Compilation completed!"
@echo "Output file: $(OUTPUT_BIN)"
compile-lib: clean
@echo "Compiling source files to library..."
@mkdir -p $(SRC_DIR) $(OUT_DIR) $(LIBRARY_DIR)
@mcs -out:$(OUTPUT_LIB) -t:library $(SOURCE_FILES)
@echo "Compilation completed!"
@echo "Output file: $(OUTPUT_LIB)"
ifeq (run, $(firstword $(MAKECMDGOALS)))
runargs := $(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))
$(eval $(runargs):;@true)
endif
run: compile-bin
@echo "Running \"$(OUTPUT_BIN)\"..."
@mono $(OUTPUT_BIN) $(runargs)
@echo "Program exited with code $$?"
dump-lib: compile-lib
monodis $(OUTPUT_LIB)