-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (32 loc) · 1000 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
41
NAME = coffee
CC = cc
SRC = $(NAME).c
OBJ = $(SRC:%.c=%.o)
INCLUDE = -I. -Iexternal
CFLAGS = -Wall -std=c99
LFLAGS = -L. -lcoffee -lm
LIBNAME = lib$(NAME)
SLIBNAME = $(LIBNAME).a
DLIBNAME = $(LIBNAME).so
.PHONY: build clean
.SECONDARY: $(OBJ) $(SLIBNAME)
build: $(SLIBNAME)
hello: $(SLIBNAME) examples/hello/main.o
@echo "*******************************************************"
@echo "** COMPILING $@"
@echo "*******************************************************"
$(CC) examples/hello/main.o -o hello $(INCLUDE) $(CFLAGS) $(LFLAGS)
%.a: $(OBJ)
@echo "*******************************************************"
@echo " ** CREATING $@"
@echo "*******************************************************"
$(AR) rcs $@ $(OBJ)
%.o: %.c
@echo "*******************************************************"
@echo "** COMPILING SOURCE $<"
@echo "*******************************************************"
$(CC) -c $< -o $@ $(INCLUDE) $(CFLAGS)
clean:
rm -f $(OBJ)
rm -f $(SLIBNAME)
rm -f hello