-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
51 lines (40 loc) · 1.16 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
# Get all .c files from src/ directory
SRC_DIR = ./src
SOURCES = $(wildcard $(SRC_DIR)/*.c) ./vendor/tomlc99/toml.c
OBJECTS = $(SOURCES:.c=.o)
LDFLAGS = -lX11
LOCINCDIRS = -I./include -I./vendor/tomlc99
OS := $(shell uname)
ifeq ($(OS), OpenBSD)
CC = cc
INCDIRS = -I/usr/X11R6/include -I/usr/local/include $(LOCINCDIRS)
LIBDIRS = -L/usr/X11R6/lib -L/usr/local/lib
else ifeq ($(OS), FreeBSD)
CC = cc
INCDIRS = -I/usr/local/include $(LOCINCDIRS)
LIBDIRS = -L/usr/local/lib
else ifeq ($(OS), NetBSD)
CC = cc
INCDIRS = -I/usr/X11R7/include -I/usr/pkg/include $(LOCINCDIRS)
LIBDIRS = -L/usr/X11R7/lib -L/usr/pkg/lib
LDFLAGS = $(LDFLAGS) -Wl,-R/usr/X11R7/lib,-R/usr/pkg/lib
else ifeq ($(OS), Linux)
CC = gcc
INCDIRS = -I/usr/include/X11 $(LOCINCDIRS)
LIBDIRS = -L/usr/lib/X11 -L/usr/local/lib
else
CC = cc
INCDIRS = -I/usr/local/include -I/usr/X11R6/include $(LOCINCDIRS)
LIBDIRS = -L/usr/local/lib -L/usr/X11R6/lib
endif
CFLAGS = -std=c11 -D_GNU_SOURCE $(INCDIRS) $(LIBDIRS)
OUTPUT = quirkwm
# Targets
all: $(OUTPUT)
$(OUTPUT): $(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) -o $(OUTPUT) $(LDFLAGS)
rm -f $(OBJECTS)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -rf $(OUTPUT) $(OBJECTS)