summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile33
1 files changed, 30 insertions, 3 deletions
diff --git a/Rakefile b/Rakefile
index 48ecab3..ef51ee2 100644
--- a/Rakefile
+++ b/Rakefile
@@ -17,11 +17,16 @@ require 'rake/loaders/makefile'
OBJ = 'candy_gear'
+VERSION = '0.1.0'
+
DATA_DIR = '/usr/local/share/candy_gear'
C_FILES = FileList[
'src/*.c'
]
+C_H_FILES = FileList[
+ 'src/*.h'
+]
C_OBJS = C_FILES.ext('.o')
CPP_FILES = FileList[
@@ -57,6 +62,25 @@ rule '.o' => ['.cpp'] do |t|
`g++ -c -std=c++17 #{t.source} -o #{t.name}`
end
+task :pkg do
+ name = "#{OBJ}-#{VERSION}"
+ files =
+ FileList[
+ 'CODE_OF_CONDUCT.markdown',
+ 'Doxyfile',
+ 'LICENSE.txt',
+ 'Rakefile',
+ 'README.markdown'
+ ] +
+ C_FILES +
+ C_H_FILES +
+ CPP_FILES +
+ RB_LIBS
+
+ `mkdir -p pkg`
+ `tar -czvf pkg/#{name}.tar.gz --transform 's,^,#{name}/,' #{files}`
+end
+
task build: OBJ_FILES do
libs = LIBRARIES.inject('') {_1 + "-l#{_2} "}
@@ -64,9 +88,12 @@ task build: OBJ_FILES do
end
task :install do
- `install #{OBJ} /usr/local/bin`
- `install -d #{DATA_DIR}/lib`
- RB_LIBS.each {`install #{_1} #{DATA_DIR}/lib`}
+ destdir = ENV['DESTDIR'] || ''
+
+ `install -d #{destdir}/usr/local/bin`
+ `install #{OBJ} #{destdir}/usr/local/bin`
+ `install -d #{destdir}#{DATA_DIR}/lib`
+ RB_LIBS.each {`install #{_1} #{destdir}#{DATA_DIR}/lib`}
end
task default: %[build]