-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (46 loc) · 1020 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
##
## Makefile
##
## Made by vincent leroy
## Login <[email protected]>
##
## Started on Mon Aug 18 14:08:46 2014 vincent leroy
## Last update Mon Mar 30 20:20:21 2015 vincent leroy
##
LIBSRC = parse_arg.c \
parse_error.c \
parse_short_opt.c \
parse_long_opt.c \
SRC = main.c \
$(LIBSRC)
CFLAGS = -Wall -Wextra
LDFLAGS =
NAME = arg
NAME_DEBUG = $(NAME).debug
LIBNAME = libparse.a
OBJ = $(SRC:.c=.o)
OBJ_DEBUG = $(SRC:.c=.debug.o)
LIBOBJ = $(LIBSRC:.c=.o)
RM = rm -f
CC = gcc
AR = ar
MAKE = make -C
all: $(NAME)
static: $(LIBNAME)
$(NAME): $(OBJ)
$(CC) $(OBJ) $(LDFLAGS) -o $(NAME)
$(LIBNAME): $(LIBOBJ)
$(AR) rsc $(LIBNAME) $(LIBOBJ)
clean:
$(RM) $(OBJ) $(OBJ_DEBUG) *.swp *~ *#
fclean: clean
$(RM) $(NAME) $(NAME_DEBUG) $(LIBNAME)
re: fclean all
debug: CFLAGS += -ggdb3
debug: $(OBJ_DEBUG)
$(CC) $(OBJ_DEBUG) $(LDFLAGS) -o $(NAME_DEBUG)
%.debug.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
.PHONY: all clean fclean re debug