facebook/scribe — Issue #45: FreeBSD build error
Author: kvspb
Created: 2011-10-19 13:41:53+00:00
State: open

```
Makefile:894: warning: overriding recipe for target `gen-cpp/_types.cpp'
Makefile:893: warning: ignoring old recipe for target `gen-cpp/_types.cpp'
/usr/local/bin/thrift -o . -I /usr/local/share/ --gen cpp:pure_enums --gen py --gen php --gen java ../if/bucketupdater.thrift
gmake all-am
gmake[1]: Entering directory `/var/ports/.../scribe/work/facebook-scribe-6600084/src'
Makefile:894: warning: overriding recipe for target `gen-cpp/_types.cpp'
Makefile:893: warning: ignoring old recipe for target `gen-cpp/_types.cpp'
gmake[1]: *** No rule to make target `gen-cpp/scribe.cpp', needed by `scribe.o'. Stop.
gmake[1]: Leaving directory `/var/ports/..../scribe/work/facebook-scribe-6600084/src'
gmake: *** [all] Error 2
```

this patch resolve build issue on FreeBSD

```diff
-- ./global_header.mk.orig 2011-06-27 09:59:22.000000000 +0400
+++ ./global_header.mk 2011-10-19 17:38:12.000000000 +0400
@@ -4,7 +4,7 @@
#endef

define thrift_template
-XTARGET := $(shell perl -e '@val = split("\/","$(2)"); $$last = pop(@val);split("\\.",$$last);print "$(1)/"."gen-cpp/"."@_[0]"."_types.cpp\n"' )
+XTARGET := $(shell perl -e '@val = split("\/","$(2)");$$last = pop(@val);@fields = split("\\.",$$last);print "$(1)/gen-cpp/@fields[0]_types.cpp\n"')

ifneq ($$(XBUILT_SOURCES),)
XBUILT_SOURCES := $$(XBUILT_SOURCES) $$(XTARGET)
```