blob: 9585f980939e3ad2b5f1b556ddf20abcf6b46cb4 (
plain)
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
|
# Debug mode:
# DEBUG = yes
# Error logging (writes to stderr):
# ERRLOG = yes
CC = gcc
LIB = libmagi.a
CFLAGS = -xc -ansi -pedantic -Wall
ifeq '$(DEBUG)' 'yes'
CFLAGS += -g -O0
else
CFLAGS += -O3
endif
ifeq '$(ERRLOG)' 'yes'
CFLAGS += -D ERRLOG
endif
SRC_DIR = src
SRC = $(wildcard $(SRC_DIR)/*.c)
OBJ = $(SRC:.c=.o)
default: $(LIB)
ifneq "clean" "$(MAKECMDGOALS)"
-include deps.mk
endif
deps.mk: $(SRC)
$(CC) -MM $^ > $@
%.o: %.c %.h
$(CC) $(CFLAGS) -c $< -o $@
$(LIB): $(OBJ)
ar rcs $@ $^
clean:
rm -f $(OBJ) $(LIB) deps.mk
|