-
Notifications
You must be signed in to change notification settings - Fork 24
/
makefile
74 lines (65 loc) · 2.26 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
# +=============================================+
# | |
# | The __ ____ ____ __ |
# | / / / __ \/ __ \/ / |
# | / / / / / / /_/ / / |
# | / /___/ /_/ / ____/ /___ |
# | /_____/_____/_/ /_____/ |
# | Programming Language |
# | http://www.ldpl-lang.org/ |
# | |
# +=============================================+
# +----------+
# | MAKEFILE |
# +----------+
# Usage:
# make [x86=true] [version='"<version>"']
# make install
# --- Version Information ---
VERSION = '"5.2.0"' #LDPL Version
VERSIONNAME = '"Groovy Gualicho"' #LDPL Version Name
# --- Options ---
# Alternative version name (make version="<version>")
ifdef version
VERSION = '"$(version)"'
endif
# x86 cross compilation options (make x86=true)
ifdef x86
CROSS = -m32
VERSION = '"$(version) (i386)"'
endif
#Flags for static compilation on Windows and Linux (not Android)
ifneq ($(shell uname -s),Darwin)
ifneq ($(shell uname -o),Android)
LFLAGS = -static-libgcc -static-libstdc++
endif
endif
#PREFIX is environment variable, but if it is not set, then set default value
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
# --- Makefile Data ---
SOURCE = ldpl.cpp
OUT = ldpl
LPMLOCATION = ~/ldpl/lpm/
LDPLLIBLOCATION = /lib/ldpl
# --- Compilation Flags ---
FLAGS = -Wall -std=gnu++11 -fpermissive -DVERSION=$(VERSION) -DVERSIONNAME=$(VERSIONNAME) -DCOMPILEDATE='"$(shell date +%Y-%m-%d)"' -DCOMPILEHOUR='"$(shell date +%H:%M:%S)"' -DLPMLOCATION='"$(DESTDIR)$(PREFIX)$(LPMLOCATION)"' -DLDPLLIBLOCATION='"$(DESTDIR)$(PREFIX)$(LDPLLIBLOCATION)"'
# --- Build Rules ---
# Build LDPL
all:
cd src && $(CXX) $(FLAGS) $(CROSS) $(SOURCE) -o $(OUT) $(LFLAGS)
mkdir -p build
mv src/$(OUT) build
# Delete built file
clean:
rm -rf build
install: build/ldpl
install -d $(DESTDIR)$(PREFIX)/bin/
install -m 775 build/ldpl $(DESTDIR)$(PREFIX)/bin/
install -d $(DESTDIR)$(PREFIX)/lib/ldpl
install src/ldpl_lib/ldpl_lib.cpp $(DESTDIR)$(PREFIX)$(LDPLLIBLOCATION)
install src/ldpl_lib/BigInt.hpp $(DESTDIR)$(PREFIX)$(LDPLLIBLOCATION)
uninstall:
rm $(DESTDIR)$(PREFIX)/bin/ldpl
rm -rf $(DESTDIR)$(PREFIX)$(LDPLLIBLOCATION)