-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (30 loc) · 947 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
# TODO
# - [ ] create new folder and put new build output in it. delete it when make clean
# - [ ] split the complie and link process as 2 divide part
GCCPREFIX =
CC := $(GCCPREFIX)gcc -pipe
GDB := $(GCCPREFIX)gdb
AS := $(GCCPREFIX)as
AR := $(GCCPREFIX)ar
LD := $(GCCPREFIX)ld
OBJCOPY := $(GCCPREFIX)objcopy
OBJDUMP := $(GCCPREFIX)objdump
NM := $(GCCPREFIX)nm
CFLAGS := -Wall
CFLAGS += -std=gnu11
LDFLAGS := -lpthread
PROGS = server client
all: ${PROGS}
server: server.c
$(CC) $(CFLAGS) server.c -O2 $(LDFLAGS) -o server
$(OBJDUMP) -S $@ > [email protected]
client: client.c
$(CC) $(CFLAGS) client.c -O2 $(LDFLAGS) -o client
$(OBJDUMP) -S $@ > [email protected]
# debug:server.c client.c irc.h
# $(CC) $(CFLAGS) server.c -O0 $(LDFLAGS) -o server_dbg
# $(CC) $(CFLAGS) client.c -O0 $(LDFLAGS) -o client_dbg
# $(OBJDUMP) -S server_dbg > server_dbg.asm
# $(OBJDUMP) -S client_dbg > client_dbg.asm
clean:
$(RM) -rf server client *_dbg *.asm