, , make gyp , make "install", "clean" .., Makefile, gyp.
, gyp , ./configure
:
+ build
|- Makefile (generated by gyp)
|- Makefile (written by hand)
|- configure (written by hand)
|- build.gyp (written by hand)
./:
#!/bin/bash
PREFIX=/usr/local
BUILDTYPE=Release
for i in "$@"
do
case $i in
-p=*|--prefix=*)
PREFIX="${i#*=}"
;;
esac
case $i in
-b=*|--buildtype=*)
BUILDTYPE="${i#*=}"
;;
esac
done
gyp -D prefix="$PREFIX" -D configuration="$BUILDTYPE" --depth=. --generator-output=./build -f make
echo -e "prefix=$PREFIX\n" > ./config.mk
Makefile:
include config.mk
prefix ?= /usr/local
builddir=build/out
abs_builddir := $(abspath $(builddir))
all: config.mk
$(MAKE) -C "./build" builddir="$(abs_builddir)"
binaries=$(prefix)/bin/foo $(prefix)/bin/bar
$(binaries): $(prefix)/bin/%: $(builddir)/%
cp $< $@
install: $(binaries) $(directories)
build.gyp:
{
'variables': {
},
'target_defaults': {
},
'targets': [
{
'target_name': 'foo',
'type': 'executable',
'defines': [],
'include_dirs':[
'src/headers'
],
'sources': [
'src/foo.c'
],
'libraries': [
'-lcrypto'
]
},
]
}
, , :
./configure
make
make install