Skip to content

Commit

Permalink
New build scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
homewsn committed Jun 24, 2015
1 parent a3d0476 commit 9fae915
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 47 deletions.
67 changes: 67 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#
# Copyright (c) 2015 Vladimir Alemasov
# All rights reserved
#
# This program and the accompanying materials are distributed under
# the terms of GNU General Public License version 2
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#

TARGET = whsniff
OBJDIR = obj
SRCDIR = src
SOURCES = $(wildcard $(SRCDIR)/*.c)
HEADERS = $(wildcard $(SRCDIR)/*.h)
OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
DEPS = $(HEADERS)

INCLPATH = -I.
LIBS = -lusb-1.0 -lrt

# Installation directories by convention
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
PREFIX = /usr/local
EXEC_PREFIX = $(PREFIX)
BINDIR = $(EXEC_PREFIX)/bin
SYSCONFDIR = $(PREFIX)/etc
LOCALSTATEDIR = $(PREFIX)/var

# main goal
all: $(TARGET)

# target executable
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBPATH) $(LIBS)

# object files
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c $(DEPS) | $(OBJDIR)
$(CC) $(CFLAGS) -c $< -o $@ $(INCLPATH)

# create object files directory
$(OBJDIR):
mkdir -p $(OBJDIR)

# clean
clean:
rm -rf $(OBJDIR)

# distclean
distclean: clean
rm -f $(TARGET)

# install
# http://unixhelp.ed.ac.uk/CGI/man-cgi?install
install: all
install -d -m 755 "$(BINDIR)"
install -m 755 $(TARGET) "$(BINDIR)/"

# uninstall
uninstall:
rm -f $(BINDIR)/$(TARGET)

.PHONY: all clean distclean install uninstall
8 changes: 5 additions & 3 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ Whsniff reads the packets from TI CC2531 USB dongle with [`sniffer_fw_cc2531` fi
$ sudo apt-get install libusb-1.0-0-dev
```

* Build release version:
* Download [the latest release](https://github.com/homewsn/whsniff/releases) in tarball from github and untar it. Then build and install whsniff.
```sh
$ cd path/to/whsniff/Makefile
$ make release
$ curl -L https://github.com/homewsn/whsniff/archive/v1.1.tar.gz | tar zx
$ cd whsniff-1.1
$ make
$ sudo make install
```


Expand Down
44 changes: 0 additions & 44 deletions src/Makefile

This file was deleted.

0 comments on commit 9fae915

Please sign in to comment.