# /*******************************************************************************/
# /*                                                                             */
# /*  Copyright 2004 Pascal Gloor                                                */
# /*                                                                             */
# /*  Licensed under the Apache License, Version 2.0 (the "License");            */
# /*  you may not use this file except in compliance with the License.           */
# /*  You may obtain a copy of the License at                                    */
# /*                                                                             */
# /*     http://www.apache.org/licenses/LICENSE-2.0                              */
# /*                                                                             */
# /*  Unless required by applicable law or agreed to in writing, software        */
# /*  distributed under the License is distributed on an "AS IS" BASIS,          */
# /*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
# /*  See the License for the specific language governing permissions and        */
# /*  limitations under the License.                                             */
# /*                                                                             */
# /*******************************************************************************/

PREFIX=/usr/local/bin
CC=cc
CFLAGS=-Wall -W -g -I. -DOS_${OS}
LDFLAGS=
INSTALL=install -c -m 755
DEMO=./demo.sh
RM=rm -f

# GNU make
OS = $(shell uname -s | tr [a-z] [A-Z])

# BSD make
OS != uname -s | tr [a-z] [A-Z]

all: clean guess_os sha256 scrypt 
	${CC} ${LDFLAGS} -o scrypt scrypt.o sha256.o

sha256:
	${CC} ${CFLAGS} -o sha256.o -c sha256.c

scrypt: 
	${CC} ${CFLAGS} -o scrypt.o -c scrypt.c

install: 
	${INSTALL} scrypt ${PREFIX};
	@echo
	@echo "run ${PREFIX}/scrypt for syntax."
	@echo

clean:
	${RM} *.o scrypt demo.txt*

demo: all
	${DEMO};

guess_os:
	@echo "looks like you're running ${OS}";
