This project is archived. Its data is
read-only
.
Changes
Page history
Update utilisation du makefile
authored
May 19, 2018
by
Florent Peterschmitt
Show whitespace changes
Inline
Side-by-side
utilisation-du-makefile.md
View page @
35a5404d
...
...
@@ -21,7 +21,7 @@ Il est possible de modifier certaines variables lors de l'exécution de certaine
-
**CGO**
pour activer ou non l'utilisation de la libc du système. Par défaut
*0*
(désactivé).
-
**BINARY**
pour changer le nom du binaire généré.
###
Docker_build
###
Docker_build
-
**IMAGE_NAME**
pour changer le nom de l'image générée. Par défaut "canopsis/" suivi du nom du projet.
-
**TAG**
pour changer le tag associé à l'image. Par défaut
*latest*
.
...
...
@@ -32,23 +32,19 @@ Il est possible de modifier certaines variables lors de l'exécution de certaine
```
makefile
include
../../Makefile.var
BINARY
:=
put a name here
BINARY
:=
${
PROJECT
}
clean
:
@echo
"Cleaning ${PROJECT} project"
-
@rm
-r
${
BINARY
}
@rm
-r
f
${BINARY}
build
:
@echo
"Building ${PROJECT} project"
@
env
GOOS
=
$(
OS
)
GOARCH
=
$(
ARCH
)
CGO_ENABLED
=
$(
CGO
)
go build
-o
${
OUTPUT_DIR
}${
BINARY
}
${
LDFLAGS
}
@env
GOOS
=
$(
OS
)
GOARCH
=
$(
ARCH
)
CGO_ENABLED
=
$(
CGO
)
go build
-o
${
OUTPUT_DIR
}
/
${
BINARY
}
${
LDFLAGS
}
docker_build
:
@echo
"Building ${PROJECT} project docker image"
ifndef
CLEAN_UP
-
@rm
-r
${
ROOT_DIR
}${
VENDOR_DIR
}
@
cd
${
ROOT_DIR
}
&&
${
DEP_MANAGER
}
install
endif
@
cd
${
ROOT_DIR
}
&&
docker build
.
--build-arg
BINARY_NAME
=
${
BINARY
}
--build-arg
PROJECT_NAME
=
${
PROJECT
}
-t
canopsis/
${
IMAGE_NAME
}
:
${
TAG
}
-f
cmd/
${
PROJECT
}
/Dockerfile
@cd
${ROOT_DIR}
&&
./build-docker.sh
${BINARY}
${TAG}
test
:
@echo
"Testing ${PROJECT} project"
...
...
...
...