Le MEILLEUR makefile de la TERRE

By Stache, 20170316_

Source: http://stackoverflow.com/a/1484873

# Thanks to Joey Adams for the boost!

# Name of the executable
TARGET = exo-sha-1

# Librairies
LIBS = -lcrypto

# Compiler
CC = gcc

# Extra parameters
CFLAGS = -std=c99 -c -Wall

# Basically explicit ignore
.PHONY: default all clean

# Aliases
default: $(TARGET)
all: default

# Useful files
OBJECTS = $(patsubst %.c,%.o,exo-sha-1.c sha.c)

# Headers
HEADERS = sha.h

# Create machine code
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@

# Won’t be deleted if shit happens ¯\_(ツ)_/¯

# Do the magic
$(CC) $(OBJECTS) -Wall $(LIBS) -o $@

# Remove the dust
-rm -f *.o
-rm -f $(TARGET)

What do you think?

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée.