summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--Rakefile33
2 files changed, 32 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index ba64cb7..2e00ba6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
candy_gear
doc
+pkg
-*.o \ No newline at end of file
+*.o
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]