Skip to content

Commit

Permalink
Merge pull request #726 from ploxiln/make_win_ext
Browse files Browse the repository at this point in the history
make: install windows binaries with .exe extension
  • Loading branch information
mreiferson committed Mar 10, 2016
2 parents cff5bd4 + e7fb6e9 commit 73cb438
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 35 deletions.
50 changes: 17 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,32 @@ DESTDIR=
GOFLAGS=
BINDIR=${PREFIX}/bin

NSQD_SRCS = $(wildcard apps/nsqd/*.go nsqd/*.go nsq/*.go internal/*/*.go)
NSQLOOKUPD_SRCS = $(wildcard apps/nsqlookupd/*.go nsqlookupd/*.go nsq/*.go internal/*/*.go)
NSQADMIN_SRCS = $(wildcard apps/nsqadmin/*.go nsqadmin/*.go nsqadmin/templates/*.go internal/*/*.go)
NSQ_PUBSUB_SRCS = $(wildcard apps/nsq_pubsub/*.go nsq/*.go internal/*/*.go)
NSQ_TO_NSQ_SRCS = $(wildcard apps/nsq_to_nsq/*.go nsq/*.go internal/*/*.go)
NSQ_TO_FILE_SRCS = $(wildcard apps/nsq_to_file/*.go nsq/*.go internal/*/*.go)
NSQ_TO_HTTP_SRCS = $(wildcard apps/nsq_to_http/*.go nsq/*.go internal/*/*.go)
NSQ_TAIL_SRCS = $(wildcard apps/nsq_tail/*.go nsq/*.go internal/*/*.go)
NSQ_STAT_SRCS = $(wildcard apps/nsq_stat/*.go internal/*/*.go)
TO_NSQ_SRCS = $(wildcard apps/to_nsq/*.go internal/*/*.go)

APPS = nsqd nsqlookupd nsqadmin nsq_pubsub nsq_to_nsq nsq_to_file nsq_to_http nsq_tail nsq_stat to_nsq
BLDDIR = build
EXT=
ifeq (${GOOS},windows)
EXT=.exe
endif

APPS = nsqd nsqlookupd nsqadmin nsq_pubsub nsq_to_nsq nsq_to_file nsq_to_http nsq_tail nsq_stat to_nsq
all: $(APPS)

$(BLDDIR)/nsqd: $(wildcard apps/nsqd/*.go nsqd/*.go nsq/*.go internal/*/*.go)
$(BLDDIR)/nsqlookupd: $(wildcard apps/nsqlookupd/*.go nsqlookupd/*.go nsq/*.go internal/*/*.go)
$(BLDDIR)/nsqadmin: $(wildcard apps/nsqadmin/*.go nsqadmin/*.go nsqadmin/templates/*.go internal/*/*.go)
$(BLDDIR)/nsq_pubsub: $(wildcard apps/nsq_pubsub/*.go nsq/*.go internal/*/*.go)
$(BLDDIR)/nsq_to_nsq: $(wildcard apps/nsq_to_nsq/*.go nsq/*.go internal/*/*.go)
$(BLDDIR)/nsq_to_file: $(wildcard apps/nsq_to_file/*.go nsq/*.go internal/*/*.go)
$(BLDDIR)/nsq_to_http: $(wildcard apps/nsq_to_http/*.go nsq/*.go internal/*/*.go)
$(BLDDIR)/nsq_tail: $(wildcard apps/nsq_tail/*.go nsq/*.go internal/*/*.go)
$(BLDDIR)/nsq_stat: $(wildcard apps/nsq_stat/*.go internal/*/*.go)
$(BLDDIR)/to_nsq: $(wildcard apps/to_nsq/*.go internal/*/*.go)

$(BLDDIR)/%:
@mkdir -p $(dir $@)
go build ${GOFLAGS} -o $@ ./apps/$*

$(APPS): %: $(BLDDIR)/%

$(BLDDIR)/nsqd: $(NSQD_SRCS)
$(BLDDIR)/nsqlookupd: $(NSQLOOKUPD_SRCS)
$(BLDDIR)/nsqadmin: $(NSQADMIN_SRCS)
$(BLDDIR)/nsq_pubsub: $(NSQ_PUBSUB_SRCS)
$(BLDDIR)/nsq_to_nsq: $(NSQ_TO_NSQ_SRCS)
$(BLDDIR)/nsq_to_file: $(NSQ_TO_FILE_SRCS)
$(BLDDIR)/nsq_to_http: $(NSQ_TO_HTTP_SRCS)
$(BLDDIR)/nsq_tail: $(NSQ_TAIL_SRCS)
$(BLDDIR)/nsq_stat: $(NSQ_STAT_SRCS)
$(BLDDIR)/to_nsq: $(TO_NSQ_SRCS)

clean:
rm -fr $(BLDDIR)

Expand All @@ -44,13 +37,4 @@ clean:

install: $(APPS)
install -m 755 -d ${DESTDIR}${BINDIR}
install -m 755 $(BLDDIR)/nsqlookupd ${DESTDIR}${BINDIR}/nsqlookupd
install -m 755 $(BLDDIR)/nsqd ${DESTDIR}${BINDIR}/nsqd
install -m 755 $(BLDDIR)/nsqadmin ${DESTDIR}${BINDIR}/nsqadmin
install -m 755 $(BLDDIR)/nsq_pubsub ${DESTDIR}${BINDIR}/nsq_pubsub
install -m 755 $(BLDDIR)/nsq_to_nsq ${DESTDIR}${BINDIR}/nsq_to_nsq
install -m 755 $(BLDDIR)/nsq_to_file ${DESTDIR}${BINDIR}/nsq_to_file
install -m 755 $(BLDDIR)/nsq_to_http ${DESTDIR}${BINDIR}/nsq_to_http
install -m 755 $(BLDDIR)/nsq_tail ${DESTDIR}${BINDIR}/nsq_tail
install -m 755 $(BLDDIR)/nsq_stat ${DESTDIR}${BINDIR}/nsq_stat
install -m 755 $(BLDDIR)/to_nsq ${DESTDIR}${BINDIR}/to_nsq
for APP in $^ ; do install -m 755 ${BLDDIR}/$$APP ${DESTDIR}${BINDIR}/$$APP${EXT} ; done
4 changes: 2 additions & 2 deletions dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ for os in linux darwin freebsd windows; do
echo "... building v$version for $os/$arch"
BUILD=$(mktemp -d -t nsq)
TARGET="nsq-$version.$os-$arch.$goversion"
GOOS=$os GOARCH=$arch CGO_ENABLED=0 make
make DESTDIR=$BUILD PREFIX=/$TARGET install
GOOS=$os GOARCH=$arch CGO_ENABLED=0 \
make DESTDIR=$BUILD PREFIX=/$TARGET install
pushd $BUILD
if [ "$os" == "linux" ]; then
cp -r $TARGET/bin $DIR/dist/docker/
Expand Down

0 comments on commit 73cb438

Please sign in to comment.