-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (24 loc) · 726 Bytes
/
Makefile
File metadata and controls
31 lines (24 loc) · 726 Bytes
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
target := nanoarch
sources := nanoarch.c
CFLAGS := -Wall -O2 -g
LDFLAGS := -static-libgcc
LIBS := -ldl
packages := gl glew glfw3 alsa
# do not edit from here onwards
objects := $(addprefix build/,$(sources:.c=.o))
ifneq ($(packages),)
LIBS += $(shell pkg-config --libs-only-l $(packages))
LDFLAGS += $(shell pkg-config --libs-only-L --libs-only-other $(packages))
CFLAGS += $(shell pkg-config --cflags $(packages))
endif
.PHONY: all clean
all: $(target)
clean:
-rm -rf build
-rm -f $(target)
$(target): Makefile $(objects)
$(CC) $(LDFLAGS) -o $@ $(objects) $(LIBS)
build/%.o: %.c Makefile
-mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c -MMD -o $@ $<
-include $(addprefix build/,$(sources:.c=.d))