This repository has been archived by the owner on Aug 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
59 lines (51 loc) · 1.77 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
#
# Makefile
#
# Copyright 2020 Alvarito050506 <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#
CFLAGS:=-I./include -DN2VM_LIB_INT -O3 -fPIC -DPIC -DNDEBUG
COMMON:=$(CFLAGS) $(EXTRA_CFLAGS) ./src/common.c
CC_CFLAGS:=-DN2CC
all: cc dir lib test
gcc ./src/n2vm.c ./src/main.c $(COMMON) -DMAIN -o ./build/n2vm
cc: dir
re2c ./src/n2cc.re -o ./build/n2cc.c
gcc ./build/n2cc.c $(COMMON) $(CC_CFLAGS) -o ./build/n2cc
lib: dir
gcc -shared -fPIC ./src/n2vm.c $(COMMON) -o ./build/libn2vm.so
test: dir
./build/n2cc -o ./build/n2_test ./test/test.n2
python3 ./src/n2as.py -o ./build/asm_test ./test/test.asm
python3 ./src/n2as.py -o ./build/base ./test/base.asm
python3 ./src/n2as.py -o ./build/emp ./test/emp.asm
cat ./build/base ./build/emp > ./build/os
dir:
mkdir -p ./build/
install:
@cp ./build/n2vm /usr/bin/n2vm
@cp ./build/n2cc /usr/bin/n2cc
@cp ./src/n2as.py /usr/bin/n2as
@cp ./build/libn2vm.so /usr/lib/libn2vm.so
@mkdir -p /usr/include/n2vm/
@cp -r ./include/. /usr/include/n2vm/
@chmod 0755 /usr/lib/libn2vm.so
@chmod a+x /usr/bin/n2vm
@chmod a+x /usr/bin/n2cc
@chmod a+x /usr/bin/n2as
clean:
rm -rf ./build/