Makefile 1.46 KB
Newer Older
1
2
3
MAM_USE_SLURM ?= 0
MAM_USE_BARRIERS ?= 0
MAM_DEBUG ?= 0
4

5
CONFIG = config.txt
6
7
PROTEO_HOME := $(shell realpath -z $$(echo "$$(pwd)/..") | tr -d '\0')

8
9
10
# Put all auto generated stuff to this build dir.
BUILD_DIR = ./build

11
# BASIC RULES
12
.PHONY : all install sam mam clean sam_clean mam_clean clear sam_clear mam_clear
13
14
15

all: install

iker_martin's avatar
iker_martin committed
16
17
# Default configuration file
$(CONFIG) : $(BUILD_DIR)/$(CONFIG)
18
19
20
21
22
23
24
25
26
$(BUILD_DIR)/$(CONFIG):
	@ mkdir -p $(@D)
	@ echo "export PROTEO_HOME=$(PROTEO_HOME)" > $(BUILD_DIR)/$(CONFIG)
	@ echo "export PROTEO_BIN=$(PROTEO_HOME)/Codes/SAM/build/a.out" >> $(BUILD_DIR)/$(CONFIG)
	@ echo "export PATH=\$$PATH:\$$PROTEO_HOME/Codes/MaM" >> $(BUILD_DIR)/$(CONFIG)
	@ echo "export LD_LIBRARY_PATH=\$$LD_LIBRARY_PATH:\$$PROTEO_HOME/Codes/MaM/build" >> $(BUILD_DIR)/$(CONFIG)
	@ echo "codeDir=\"/Codes\"" >> $(BUILD_DIR)/$(CONFIG)
	@ echo "execDir=\"/Exec\"" >> $(BUILD_DIR)/$(CONFIG)

27

28
29
30
mam:
	@echo "Compiling MaM"
	$(MAKE) -C MaM MAM_USE_SLURM=$(MAM_USE_SLURM) MAM_USE_BARRIERS=$(MAM_USE_BARRIERS) MAM_DEBUG=$(MAM_DEBUG)
31

32
33
sam: mam
	@echo "Compiling SAM"
34
	$(MAKE) -C SAM MAM_DEBUG=$(MAM_DEBUG)
35

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
install: mam sam $(CONFIG)
	echo "Done"

#Clean rules
sam_clean:
	@echo "Cleaning SAM"
	$(MAKE) -C SAM clean
mam_clean:
	@echo "Cleaning MaM"
	$(MAKE) -C MaM clean
clean: sam_clean mam_clean
	-rm $(BUILD_DIR)/$(CONFIG)

#Clear rules
sam_clear:
	@echo "Clearing SAM"
	$(MAKE) -C SAM clear
mam_clear:
	@echo "Clearing MaM"
	$(MAKE) -C MaM clear
clear: sam_clear mam_clear
	-rm -rf $(BUILD_DIR)
58