Makefile 772 Bytes
Newer Older
1
2
export TOP := $(dir $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
BUILD := build
3
4
5
EXEC := exec

EXECDIR := $(addprefix $(TOP),$(EXEC))
6
7
8
export BUILDDIR = $(addprefix $(TOP),$(BUILD))
SUBDIRS := IOcodes Main malleability

9
.PHONY: subdirs $(SUBDIRS) build all clean clear
10
11
12
13
14
15
#
#
#
#
CC := gcc
MCC := mpicc
16
CFLAGS := -Wall -Wextra
17
18
19
20
21
22
23
LIBFLAGS := -lm -lslurm -pthread
#
#
#
#

all: subdirs exec
24
25
install: 
	#runTests
26
27

exec: subdirs
28
29
	mkdir -p $(EXECDIR) all
	$(MCC) $(CFLAGS) -o $(EXECDIR)/a.out $(wildcard $(BUILDDIR)/*.o) $(LIBFLAGS)
30
31
32
33
34
35

subdirs: $(SUBDIRS)
$(SUBDIRS): | $(BUILD)
	$(MAKE) -C $@


36
# Carpeta en la que almacenar los compilados y los ejecutables
37
$(BUILD):
38
	mkdir -p $(BUILDDIR)
39
40

clean:
41
42
43
44
45
	-rm $(BUILDDIR)/*.o
clear:
	-rm -rf $(BUILDDIR)
	-rm -rf $(EXECDIR)