forked from kevinboone/fblife
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (31 loc) · 1 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
NAME := fblife
VERSION := 1.0a
CC := gcc
LIBS := ${EXTRA_LIBS}
TARGET := $(NAME)
SOURCES := $(shell find src/ -type f -name *.c)
OBJECTS := $(patsubst src/%,build/%,$(SOURCES:.c=.o))
DEPS := $(OBJECTS:.o=.deps)
DESTDIR := /
PREFIX := /usr
MANDIR := $(DESTDIR)/$(PREFIX)/share/man
BINDIR := $(DESTDIR)/$(PREFIX)/bin
SHARE := $(DESTDIR)/$(PREFIX)/share/$(TARGET)
CFLAGS := -g -fpie -fpic -Wall -DNAME=\"$(NAME)\" -DVERSION=\"$(VERSION)\" -DSHARE=\"$(SHARE)\" -DPREFIX=\"$(PREFIX)\" -I include ${EXTRA_CFLAGS}
LDFLAGS := -pie ${EXTRA_LDFLAGS}
all: $(TARGET)
debug: CFLAGS += -g
debug: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
build/%.o: src/%.c
@mkdir -p build/
$(CC) $(CFLAGS) -MD -MF $(@:.o=.deps) -c -o $@ $<
clean:
@echo " Cleaning..."; $(RM) -r build/ $(TARGET)
install: $(TARGET)
mkdir -p $(DESTDIR)/$(PREFIX) $(DESTDIR)/$(BINDIR) $(DESTDIR)/$(MANDIR)
strip $(TARGET)
install -m 755 $(TARGET) $(DESTDIR)/${BINDIR}
-include $(DEPS)
.PHONY: clean