Skip to content
Permalink
Browse files

Add Makefile, tools/ scripts

  • Loading branch information...
nickolasburr committed Jun 15, 2018
1 parent 1420078 commit 6a099a191de1a37e4d59791e5197fb0517d4dfc3
Showing with 91 additions and 0 deletions.
  1. +43 −0 Makefile
  2. +14 −0 tools/clean.sh
  3. +19 −0 tools/install.sh
  4. +15 −0 tools/uninstall.sh
@@ -0,0 +1,43 @@
###
### Makefile
###

CC = gcc
TARGET = rng
INSTALL = /usr/bin/install -c

prefix = /usr/local
bindir = $(prefix)/bin
binprefix =

ARFLAGS = rcs
RM = rm
RMFLAGS = -rf

INCLUDE = include
SOURCES = src
TOOLS = tools

CSFILES = $(wildcard $(SOURCES)/*.c)
OBFILES = $(patsubst %.c,%.o,$(CSFILES))

KERNEL := $(shell sh -c 'uname -s 2>/dev/null || echo unknown')

CFLAGS = -I$(INCLUDE)
LDFLAGS = -pthread -lz

.PHONY: all clean install uninstall

all: $(TARGET)

$(TARGET): $(CSFILES)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

clean:
@cd $(TOOLS) && ./clean.sh

install:
@cd $(TOOLS) && ./install.sh

uninstall:
@cd $(TOOLS) && ./uninstall.sh
@@ -0,0 +1,14 @@
#!/bin/sh

set -ex

PROJDIR="$(dirname $PWD)"
TARGET="rng"

if test -f "$PROJDIR/$TARGET"; then
rm -rf "$PROJDIR/$TARGET"
fi

if test -d "$PROJDIR/$TARGET.dSYM"; then
rm -rf "$PROJDIR/$TARGET.dSYM"
fi
@@ -0,0 +1,19 @@
#!/bin/sh

set -ex

PREFIX=/usr/local
BINDIR=$PREFIX/bin

TARGET="rng"
MANPAGE="$TARGET.1.gz"
MANDEST=$PREFIX/share/man/man1

INSTALL=/usr/bin/install
OPTIONS="-c"

cd ..

cp "man/$MANPAGE" "$MANDEST/$MANPAGE"

$INSTALL $OPTIONS $TARGET $BINDIR/$TARGET
@@ -0,0 +1,15 @@
#!/bin/sh

set -ex

PREFIX=/usr/local
BINDIR=$PREFIX/bin

RM="rm"
RMFLAGS="-rf"

TARGET="rng"
MANPAGE="$TARGET.1.gz"
MANDEST=$PREFIX/share/man/man1

$RM $RMFLAGS $BINDIR/$TARGET $MANDEST/$MANPAGE

0 comments on commit 6a099a1

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.