-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (41 loc) · 995 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
40
41
42
43
44
45
46
47
48
49
50
51
52
## Project settings
PROJECT_NAME ?= glisy
## Source files
SRC := $(wildcard src/*.c)
## Dependency source files
SRC += $(wildcard deps/glisy/*.c)
SRC += $(wildcard deps/rgba/*.c)
## Source objects
OBJS := $(SRC:.c=.o)
## Compiler flags
CFLAGS += -Ideps
CFLAGS += -Iinclude
CFLAGS += -Wall
CFLAGS += -O2
## Target static library
TARGET_STATIC := lib$(PROJECT_NAME).a
## Builds everything
.PHONY: all
all: $(TARGET_STATIC)
## Builds static library
$(TARGET_STATIC): $(OBJS)
$(AR) crus $@ $^
## Compiles object files
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
## Installs library into system
.PHONY: install
install: $(TARGET_STATIC)
$(CP) -r include/* $(PREFIX)/include/
$(CP) -r deps/glisy/*.h $(PREFIX)/include/glisy
$(CP) $(TARGET_STATIC) $(PREFIX)/lib
## Uninstalls library from system
.PHONY: uninstall
uninstall:
$(RM) -r $(PREFIX)/include/$(PROJECT_NAME)
$(RM) $(PREFIX)/lib/$(TARGET_STATIC)
## Cleans project directory
.PHONY: clean
clean:
$(RM) $(OBJS)
$(RM) $(TARGET_STATIC)