-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
106 lines (76 loc) · 2.24 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
TYPE = $(shell uname -s)
TYPE != uname -s
NAME = zwm
CC = gcc
CD = cd
MAKE = make
CP = cp -r
RM = rm -rf
FIND = find
LOG = liblog.a
LOGDIR = $(LIBDIR)/log
LISTS = liblists.a
LISTSDIR = $(LIBDIR)/lists
LIBDIR = libs
INSTALLDIR = $(HOME)/bin
CFLAGS += -O2 -Werror -DNDEBUG
#CFLAGS = -g3
CFLAGS += -W -Wall -pedantic -std=c99
CFLAGS += -D${TYPE} -D_REENTRANT -D__EXTENSIONS__
CFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_BSD_SOURCE -D_GNU_SOURCE
CFLAGS += -I$(HDRDIR) -I/usr/X11R6/include -I$(LOGDIR)/include -I$(LISTSDIR)/include
LDFLAGS = -L/usr/X11R6/lib -lX11 -L$(LIBDIR) -llog -llists
SRCDIR = src
HDRDIR = include
SRCS = $(SRCDIR)/commands/kill_client.c \
$(SRCDIR)/commands/master_size.c \
$(SRCDIR)/commands/move_focus.c \
$(SRCDIR)/commands/move_window.c \
$(SRCDIR)/commands/quit.c \
$(SRCDIR)/commands/resize.c \
$(SRCDIR)/commands/spawn.c \
$(SRCDIR)/commands/switch_layout.c \
$(SRCDIR)/commands/workspace.c \
$(SRCDIR)/commands/zoom.c \
$(SRCDIR)/layouts/htile.c \
$(SRCDIR)/layouts/mirror.c \
$(SRCDIR)/layouts/monocle.c \
$(SRCDIR)/layouts/tile.c \
$(SRCDIR)/windows.c \
$(SRCDIR)/zwm.c
OBJS = $(SRCS:.c=.o)
HDRS =
$(NAME): lib_log lib_lists $(SRCS) $(OBJS) $(HDRS)
$(CC) $(OBJS) -o $(NAME) $(LDFLAGS)
# Dependencies -----------------------------------------------------------------
lib_log:
$(CD) $(LOGDIR); $(MAKE) "CFLAGS=$(CFLAGS)" all
$(CP) $(LOGDIR)/$(LOG) $(LIBDIR)
clean_lib_log:
$(CD) $(LOGDIR); $(MAKE) fclean
lib_lists:
$(CD) $(LISTSDIR); $(MAKE) "CFLAGS=$(CFLAGS)" all
$(CP) $(LISTSDIR)/$(LISTS) $(LIBDIR)
clean_lib_lists:
$(CD) $(LISTSDIR); $(MAKE) fclean
# Common ----------------------------------------------------------------------
all: $(NAME)
install: all
$(CP) $(NAME) $(INSTALLDIR)/$(NAME)
deinstall:
$(RM) $(INSTALLDIR)/$(NAME)
clean:
$(RM) $(OBJS)
$(RM) $(LIBDIR)/*.a
$(FIND) . -name "*~" -print -exec rm -f {} \;
$(FIND) . -name "*\#*" -print -exec rm -f {} \;
$(RM) $(NAME).core
$(RM) vgcore*
fclean: clean clean_lib_log clean_lib_lists
$(RM) $(NAME)
$(RM) TAGS
mrproper: $(NAME) clean
re: fclean $(NAME)
.c.o:
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
.PHONY: clean all fclean mrproper re