-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (37 loc) · 1.07 KB
/
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
# define the install directory
INSTALL-DIR = /usr/local/bin/
# define the C compiler to use
CC = gcc
# define any compile-time flags
CFLAGS = -Wall -pthread
# define any directories containing header files other than /usr/include
INCLUDES =
# define library paths in addition to /usr/lib
LFLAGS =
# define any libraries to link into executable:
LIBS = -lm
# define the C source files
SRCS = cpusm.c
# define the C object files
OBJS = $(SRCS:.c=.o)
# define the executable file
MAIN = cpusm
.PHONY: depend clean static install
all: $(MAIN)
$(MAIN): $(OBJS)
@echo building dynamically-linked, platform-independent shared-object executable
$(CC) $(CFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS)
strip $(MAIN)
static:
@echo building statically-linked platform-independent executable
$(CC) -c -fpic -o $(OBJS) $(SRCS)
$(CC) $(CFLAGS) $(INCLUDES) --static -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS)
strip $(MAIN)
.c.o:
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
clean:
$(RM) *.o *~ $(MAIN)
install:
cp $(MAIN) $(INSTALL-DIR)
depend: $(SRCS)
makedepend $(INCLUDES) $^