# Makefile for petit (tested with GNU Make)
#
# - 'make' or 'make petit' compiles the executable and create the info file.
# - 'make link' creates the symlink 'petit'.
# - 'make clean' removes the exec objects and info file.

user := `whoami`
host := `hostname` \(`lsb_release -ds`\)
date := `date +"%F %T"`
info := Compiled using Makefile by $(user) in $(host) on $(date)

CC = gcc
CFLAGS = -O3 -ffast-math -funroll-loops -fomit-frame-pointer
LDLIBS = -lm
exec = petit-gcc

.PHONY: default link clean

default: petit

petit:
	$(CC) $(CFLAGS) petit.c -o $(exec) $(LDLIBS)
	echo $(info) > compilation.info

link:
	ln -s $(exec) petit

clean:
	rm -f $(exec) petit compilation.info

