-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (49 loc) · 1.5 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
# Paths
PATH_LOCAL ?= /usr/local
PATH_X11 ?= /usr/X11R6
PATH_MAN ?= ${PATH_LOCAL}/share/man
PATH_CONFIG ?= ${HOME}/.config
PATH_LOCAL_INC ?= ${PATH_LOCAL}/include
PATH_LOCAL_LIB ?= ${PATH_LOCAL}/lib
PATH_X11_INC ?= ${PATH_X11}/include
PATH_X11_LIB ?= ${PATH_X11}/lib
PATH_FREETYPE_INC ?= /usr/include/freetype2
INSTALL_PATH ?= /usr/local/bin
# Includes/Libs/Flags
INCLUDE = -I${PATH_LOCAL_INC} -I${PATH_X11_INC} -I${PATH_FREETYPE_INC} -I${PATH_X11_INC}/freetype2
LIB = -L${PATH_LOCAL_LIB} -L${PATH_X11_LIB} -lfontconfig -lXft -lX11 -lXrender
CFLAGS += -O3
# Targets
TARGET = melonbar
CFILES = $(wildcard include/*.c)
OBJS = $(patsubst include%,lib%,$(CFILES:.c=.o))
OBJDIR = ./lib
all: $(OBJS)
@echo ''
@echo '=====| Building $(TARGET) |====='
${CC} $(TARGET).c $(INCLUDE) $(LIB) ${CFLAGS} -o $(TARGET) $(OBJS)
lib/%.o : include/%.c | $(OBJDIR)
@echo ''
@echo '=====| Building $@ |====='
${CC} $< $(INCLUDE) $(LIB) ${CFLAGS} -c -o $@
$(OBJDIR):
mkdir ./lib
install: all
@echo ''
@echo '=====| Installing $(TARGET) |====='
install -m 755 $(TARGET) ${INSTALL_PATH}/$(TARGET)
@echo ''
@echo 'Make sure to create a `melonbar` directory in .config'
@echo 'and place the config file in there.'
config: all
@echo ''
@echo '=====| Creating ${PATH_CONFIG}/melonbar |====='
mkdir -p ${PATH_CONFIG}/melonbar
@echo '=====| Copying config file |====='
install -m 755 melonbar.conf ${PATH_CONFIG}/melonbar/melonbar.conf
clean:
@echo ''
@echo '=====| Cleaning |====='
-rm $(OBJS)
-rm $(TARGET)
.SILENT: $(OBJDIR) clean