1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

Makefile: 'make install' should build v too.

This commit is contained in:
Delyan Angelov 2019-08-10 11:20:59 +03:00 committed by Alexander Medvednikov
parent cb7e87589c
commit 58b52aa9fb
2 changed files with 16 additions and 9 deletions

2
.gitignore vendored
View File

@ -6,6 +6,8 @@
/v.*.c /v.*.c
/v.c.out /v.c.out
/v.exe /v.exe
/tools/vget
/tools/vget.exe
*.exe *.exe
*.o *.o
.*.c .*.c

View File

@ -3,13 +3,13 @@ CFLAGS ?= -O2 -fPIC
PREFIX ?= /usr/local PREFIX ?= /usr/local
VC ?= 0.1.17 VC ?= 0.1.17
all: v all: v tools/vget
$(info V has been successfully built) $(info V has been successfully built)
v: v.c.out compiler/*.v vlib/**/*.v v: v.c.out compiler/*.v vlib/**/*.v
./v.c.out -o v compiler ./v.c.out -o v compiler
v-release: v-release: v
./v -cflags '${CFLAGS}' -o v compiler ./v -cflags '${CFLAGS}' -o v compiler
strip v strip v
@ -20,6 +20,9 @@ v.${VC}.c:
#curl -o v.${VC}.c -LsSf https://github.com/vlang/vc/raw/${VC}/v.c #curl -o v.${VC}.c -LsSf https://github.com/vlang/vc/raw/${VC}/v.c
curl -o v.${VC}.c -LsSf https://raw.githubusercontent.com/vlang/vc/master/v.c curl -o v.${VC}.c -LsSf https://raw.githubusercontent.com/vlang/vc/master/v.c
tools/vget: v
./v tools/vget.v
test: v test: v
./v -prod -o vprod compiler # Test prod build ./v -prod -o vprod compiler # Test prod build
echo "Running V tests..." echo "Running V tests..."
@ -29,15 +32,15 @@ test: v
bash ./compiler/tests/repl/repl.sh bash ./compiler/tests/repl/repl.sh
clean: clean:
-rm -f v.c v*.c v.c.out v vprod thirdparty/**/*.o -rm -f v.c v*.c v.c.out v vprod thirdparty/**/*.o tools/vget
find . -name '.*.c' -print0 | xargs -0 -n1 rm -f find . -name '.*.c' -print0 | xargs -0 -n1 rm -f
SOURCES = $(wildcard thirdparty/**/*.c) SOURCES = $(wildcard thirdparty/**/*.c)
OBJECTS := ${SOURCES:.c=.o} OBJECTS := ${SOURCES:.c=.o}
thirdparty: ${OBJECTS} thirdparty: v ${OBJECTS}
thirdparty-release: ${OBJECTS} thirdparty-release: v ${OBJECTS}
strip ${OBJECTS} strip ${OBJECTS}
debug: clean v thirdparty debug: clean v thirdparty
@ -45,13 +48,15 @@ debug: clean v thirdparty
release: CFLAGS += -pie release: CFLAGS += -pie
release: clean v-release thirdparty-release release: clean v-release thirdparty-release
install: uninstall install: uninstall all
mkdir -p ${PREFIX}/lib/vlang ${PREFIX}/bin mkdir -p ${PREFIX}/lib/vlang ${PREFIX}/bin
cp -r v vlib thirdparty ${PREFIX}/lib/vlang cp -r {v,tools,vlib,thirdparty} ${PREFIX}/lib/vlang
ln -sf ${PREFIX}/lib/vlang/v ${PREFIX}/bin/v ln -sf ${PREFIX}/lib/vlang/v ${PREFIX}/bin/v
ln -sf ${PREFIX}/lib/vlang/tools/vget ${PREFIX}/bin/vget
uninstall: uninstall:
rm -rf ${PREFIX}/{bin/v,lib/vlang} rm -rf ${PREFIX}/{bin/v,bin/vget,lib/vlang}
symlink: symlink: v tools/vget
ln -sf `pwd`/v ${PREFIX}/bin/v ln -sf `pwd`/v ${PREFIX}/bin/v
ln -sf `pwd`/tools/vget ${PREFIX}/bin/vget