Skip to content

Commit

Permalink
Add Makefile for easy installation
Browse files Browse the repository at this point in the history
  • Loading branch information
cytopia committed Aug 31, 2016
1 parent 5dcd07c commit 54fd692
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 10 deletions.
74 changes: 74 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
######################################
# CUSTOM
######################################

configure.in
Makefile.in


######################################
# GENERIC
######################################

###### std ######
.lock
*.log

###### patches/diffs ######
*.patch
*.diff
*.orig
*.rej


######################################
# Operating Systems
######################################

###### OSX ######
._*
.DS*
.Spotlight-V100
.Trashes

###### Windows ######
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
*.lnk


######################################
# Editors
######################################

###### Sublime ######
*.sublime-workspace
*.sublime-project

###### Eclipse ######
.classpath
.buildpath
.project
.settings/

###### Netbeans ######
nbproject/private/

###### Intellij IDE ######
.idea/
.idea_modules/

###### vim ######
*.swp
*.swo
*~

###### TextMate ######
.tm_properties
*.tmproj

###### BBEdit ######
*.bbprojectd
*.bbproject
62 changes: 62 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Unix Makefile

# Configuration
SHELL = /bin/sh

MKDIR_P = mkdir -p

# Check if './configure' has been run
ifneq ("$(wildcard configure.in)","")
CONFIGURED = 1
include configure.in
else
CONFIGURED = 0
endif


all:

ifeq ($(CONFIGURED),0)
$(error Not configured, run ./configure)
endif


@echo "Nothing to make."
@echo "Type 'make install'"


help:
@echo Options
@echo " make install"
@echo " Install everthing (requires sudo or root)"
@echo ""
@echo " make clean"
@echo " Clean build"
@echo ""
@echo " make help"
@echo " Show this help screen"


install:


@echo "Installing files"
@echo ""

@# Create directories
${MKDIR_P} $(BINDIR)

@# Install binary
install -m 0755 dependencies/* $(BINDIR)/
install -m 0755 bin/* $(BINDIR)/


@echo "Installation complete:"
@echo "----------------------------------------------------------------------"
@echo ""


clean:

rm -f configure.in

38 changes: 28 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,31 @@ Lot's of tools for git, file and static source code analysis.

---

## Install

```bash
# Install to /usr/bin
./configure
make install

# Instal to /usr/local/bin
./configure --prefix=/usr/local
make install

# Install to /opt/bin
./configure --prefix=/opt
make install
```


## Usage

* All tools share the same pattern (except `git-ignored`) and can be used with the same command line arguments.
* Some tools have an additional option `--custom=""` to overwrite the command itself (this is explained and shown in detail in each command's `--help` option).

**General usage options:**

```shell
```bash
# Required:
--path # Specify the path where to scan

Expand Down Expand Up @@ -126,7 +143,7 @@ Scan files and check if they contain BOM (Byte Order Mark): `<U+FEFF>`.

Scan shell files for bash syntax errors.

```shell
```bash
# By extension
$ syntax-bash --text --size --extension=sh,bash --path=.

Expand Down Expand Up @@ -168,7 +185,7 @@ Scan files for Markdown syntax errors.

Scan Perl files for Perl syntax errors.

```shell
```bash
# By extension
$ syntax-perl --text --size --extension=pl --path=.`
Expand All @@ -181,7 +198,8 @@ $ syntax-perl --text --size --shebang=perl --path=.`

Scan files for PHP syntax errors.

```shell
```bash

# By extension
$ syntax-php --text --size --extension=php,inc --path=.`
Expand All @@ -194,7 +212,7 @@ $ syntax-php --text --size --shebang=php --path=.`

Scan Python files for Python syntax errors.

```shell
```bash
# By extension
$ syntax-python --text --size --extension=py --path=.`
Expand All @@ -207,7 +225,7 @@ $ syntax-python --text --size --shebang=python --path=.`

Scan Ruby files for Ruby syntax errors.

```shell
```bash
# By extension
$ syntax-ruby --text --size --extension=rb --path=.`
Expand All @@ -227,7 +245,7 @@ Scan SCSS files for SCSS syntax errors.

Scan shell files for /bin/sh syntax errors.

```shell
```bash
# By extension
$ syntax-sh --text --size --extension=sh,bash --path=.`
Expand Down Expand Up @@ -295,23 +313,23 @@ Escapes for Bash (and alike)

Check for css tags containing: `url('/` or `url("/` or `url(/`

```shell
```bash
$ regex-grep --path=. --extension=css,scss --text --size --custom="url\([[:space:]]*['\''\\\"]?[[:space:]]*/"

$ regex-perl --path=. --extension=css,scss --text --size --custom="url\([[:space:]]*[\x27\"]?[[:space:]]*\/"
```

Check for css tags containing: `url('http[s]://` or `url("http[s]://` or `url(http[s]://`

```shell
```bash
$ regex-grep --path=. --extension=css,scss --text --size --custom="url\([[:space:]]*['\''\\\"]?[[:space:]]*http[s]?://"

$ regex-perl --path=. --extension=css,scss --text --size --custom="url\([[:space:]]*[\x27\"]?[[:space:]]*http[s]?:\/\/"
```

Check common html file tpyes for `href="http[s]*://`

```shell
```bash
$ regex-grep --path=. --extension=htm,html,php,tpl --text --size --custom="href=[[:space:]]*['\''\\\"]?http[s]?://"

$ regex-perl --path=. --extension=htm,html,php,tpl --text --size --custom="href=[[:space:]]*[\x27\"]?http[s]?:\/\/"
Expand Down
70 changes: 70 additions & 0 deletions configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/bin/sh

# This is a leight-weight self-styled configure script


PREFIX=""

print_help() {

echo "Usage: configure [--prefix]"
echo ""
echo "--prefix Specify custom install prefix."
echo " e.g. --prefix=/usr/local"
echo ""
}


while [ $# -gt 0 ]; do

case "$1" in

--help)
print_help
exit 0
;;

--prefix*)
CUSTOM_PREFIX="$(echo "$1" | $(which sed) 's/^--prefix=//g')"
# Remove trailing slash
CUSTOM_PREFIX="/$(echo "${CUSTOM_PREFIX}" | $(which sed) 's#/*$##;s#^/*##')"
PREFIX="${CUSTOM_PREFIX}"
;;

*)
echo "Invalid argument: '${1}'"
echo "Type '${0} --help' for available options."
exit 1
;;
esac
shift
done


if [ -z "${PREFIX}" ]; then
BINDIR="/usr/bin"
else
BINDIR="${PREFIX}/bin"
fi



# Write configure configuration file
echo "PREFIX = ${PREFIX}" > configure.in
echo "ETCDIR = ${ETCDIR}" >> configure.in
echo "BINDIR = ${BINDIR}" >> configure.in
echo "MANDIR = ${MANDIR}" >> configure.in

echo ""
echo "Configure run successfully"
echo ""
if [ -z "${PREFIX}" ]; then
echo " Install prefix: /"
else
echo " Install prefix: ${PREFIX}"
fi
echo ""
echo " ${BINDIR}/"
echo ""
echo "Run 'make install' to install"
exit 0

0 comments on commit 54fd692

Please sign in to comment.