summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2011-09-15 21:56:28 +0200
committerFlorian Pritz <bluewind@xinu.at>2011-09-15 21:56:28 +0200
commitb87e747713d6fcf2e67e9e187527fb2b040a5979 (patch)
tree3303cc07d1d980df6d59aca5598f0d2341c843fa
parent0172c067dfd3c349611f3de453a8dcb389ce8688 (diff)
use define instead of sed for VERSION expansion in helper
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--.gitignore1
-rw-r--r--Makefile10
-rw-r--r--fb-helper.c (renamed from fb-helper.c.in)2
3 files changed, 4 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 5afae78..e25dfe7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,3 @@ dist
fb.1
fb
fb-helper
-fb-helper.c
diff --git a/Makefile b/Makefile
index b976361..2ffeeb5 100644
--- a/Makefile
+++ b/Makefile
@@ -12,18 +12,14 @@ fb: fb.in
sed 's|@VERSION@|$(VERSION)|; s|@LIBDIR@|$(LIBDIR)|' $< > $@
chmod 755 $@
-%:: %.in
- @[ -n "$(VERSION)" ] || (echo "Error: version detection failed"; exit 1)
- sed 's|@VERSION@|$(VERSION)|; s|@LIBDIR@|$(LIBDIR)|' $< > $@
-
fb-helper: fb-helper.c
- $(CC) $(CFLAGS) -lcurl -o $@ $<
+ $(CC) $(CFLAGS) -lcurl -DVERSION=\"$(VERSION)\" -o $@ $<
fb.1: fb.pod
pod2man -c "" $< $@
clean:
- rm -f fb.1 fb fb-helper.c fb-helper
+ rm -f fb.1 fb fb-helper
rm -rf dist
install: all
@@ -39,7 +35,7 @@ uninstall:
dist: all
@[ -n "$(VERSION)" ] || (echo "Error: version detection failed"; exit 1)
mkdir -p dist/fb-$(VERSION)
- cp -a fb-helper.c{,.in} fb{,.in} fb.pod fb.1 COPYING Makefile dist/fb-$(VERSION)
+ cp -a fb-helper.c fb{,.in} fb.pod fb.1 COPYING Makefile dist/fb-$(VERSION)
sed -i 's/^VERSION:=.*$$/VERSION:='$(VERSION)'/' dist/fb-$(VERSION)/Makefile
cd dist; tar -czf fb-$(VERSION).tar.gz fb-$(VERSION)
diff --git a/fb-helper.c.in b/fb-helper.c
index 75553a2..81428fa 100644
--- a/fb-helper.c.in
+++ b/fb-helper.c
@@ -141,7 +141,7 @@ int main(int argc, char *argv[])
CURL *curl;
CURLcode res;
- char *userAgent = "fb-client/@VERSION@";
+ char *userAgent = "fb-client/"VERSION;
struct progressData cb_data = {
.starttime = {.tv_sec = 0, .tv_usec = 0},