-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
130 lines (96 loc) · 2.55 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Copyright (c) 2022-2024 embed-dsp, All Rights Reserved.
# Author: Gudmundur Bogason <gb@embed-dsp.com>
# Select between serial or parallel (Open MPI) builds.
SERPAR = serial
# SERPAR = parallel
PACKAGE_NAME = Xyce
PACKAGE_VERSION = 7.8
PACKAGE = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
TRILINOS_VERSION = release-12-12-1
# ==============================================================================
# Determine system.
SYSTEM = unknown
ifeq ($(findstring Linux, $(shell uname -s)), Linux)
SYSTEM = linux
endif
ifeq ($(findstring MINGW32, $(shell uname -s)), MINGW32)
SYSTEM = mingw32
endif
ifeq ($(findstring MINGW64, $(shell uname -s)), MINGW64)
SYSTEM = mingw64
endif
# Determine machine.
MACHINE = $(shell uname -m)
# Architecture.
ARCH = $(SYSTEM)_$(MACHINE)
# ==============================================================================
# Set number of simultaneous jobs (Default 8)
ifeq ($(J),)
J = 8
endif
CONFIGURE_FLAGS = --enable-stokhos --enable-amesos2
# Configuration for linux system.
ifeq ($(SYSTEM),linux)
ifeq ($(SERPAR),serial)
# Compiler.
CC = /usr/bin/gcc
CXX = /usr/bin/g++
endif
ifeq ($(SERPAR),parallel)
# FIXME: Open MPI Compiler.
CC = /usr/bin/gcc
CXX = /usr/bin/g++
CONFIGURE_FLAGS += --enable-mpi
endif
# Installation directory.
INSTALL_DIR = /opt
endif
# Configuration for mingw64 system.
# ifeq ($(SYSTEM),mingw64)
# # Compiler.
# CC = /mingw64/bin/gcc
# CXX = /mingw64/bin/g++
# # Installation directory.
# INSTALL_DIR = /c/opt
# endif
CXXFLAGS = -O2
# ...
TRILINOS = /opt/trilinos/$(ARCH)/trilinos-$(TRILINOS_VERSION)-$(SERPAR)
# Installation directory.
PREFIX = $(INSTALL_DIR)/$(PACKAGE_NAME)/$(ARCH)/$(PACKAGE)-$(SERPAR)
# ==============================================================================
all:
@echo "ARCH = $(ARCH)"
@echo "PREFIX = $(PREFIX)"
@echo ""
@echo "## Build"
@echo "make prepare"
@echo "make configure [SERPAR=parallel]"
@echo "make compile [J=...]"
@echo ""
@echo "## Install"
@echo "[sudo] make install"
@echo ""
@echo "## Cleanup"
@echo "make clean"
@echo "make distclean"
@echo ""
.PHONY: prepare
prepare:
-mkdir build
cd build && tar zxf ../src/$(PACKAGE).tar.gz
.PHONY: configure
configure:
cd build/$(PACKAGE) && ./configure CXX=$(CXX) CXXFLAGS=$(CXXFLAGS) ARCHDIR=$(TRILINOS) --prefix=$(PREFIX) $(CONFIGURE_FLAGS)
.PHONY: compile
compile:
cd build/$(PACKAGE) && make -j$(J)
.PHONY: install
install:
cd build/$(PACKAGE) && make install
.PHONY: clean
clean:
cd build/$(PACKAGE) && make clean
.PHONY: distclean
distclean:
cd build/$(PACKAGE) && make distclean