-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
41 lines (33 loc) · 975 Bytes
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Autoversion makefile
# (C) 2015, Ruben Carlo Benante
# Data: 2015-10-07
# Versao para Allegro
#Usage:
# * From linux prompt:
# - Normal C program (ex1.c)
# $ make ex1.x
# - Aspipo program (ex1.c)
# $ make ex1.x obj=libaspipo-ux64.o
# * From vim command:
# - Normal C program (ex1.c)
# :make
# - Aspipo program (ex1.c)
# :make obj=libaspipo-ux64.o
.PHONY: clean
.PRECIOUS: %.o
SHELL=/bin/bash -o pipefail
MAJOR = 0
MINOR = 1
BUILD = $(shell date +"%g%m%d.%H%M%S")
DEFSYM = $(subst .,_,$(BUILD))
VERSION = "\"$(MAJOR).$(MINOR).$(BUILD)\""
CC = gcc
CFLAGS = -Wall -g -O0 -std=gnu99
CFLAGS = -Wall `allegro-config --cflags --libs`
#-ansi -pedantic-errors -c -Ofast -Wextra
CPPFLAGS = -DVERSION=$(VERSION) -DBUILD="\"$(BUILD)\""
LDLIBS = -Wl,--defsym,BUILD_$(DEFSYM)=0 -lm -lgmp `allegro-config --cflags --libs`
%.x : %.c $(obj)
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDLIBS) $^ -o $@ |& tee errors.err
clean:
rm -f *.x *.o errors.err