-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
43 lines (40 loc) · 1.18 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
#default compiler (for windows)
CC := gcc
# application name
APPNAME := gtkate
SYMNAME := $(APPNAME)_dev
# source/output directories
BINDIR := bin
OBJDIR := obj
SRCDIR := .
# compiler flags
CFLAGS := -Wall -Wextra -pedantic -finline-functions -std=gnu11 -Ofast
CFLAGS += `pkg-config --cflags gtk+-2.0`
CFLAGS += `pkg-config --cflags gtksourceview-2.0`
CFLAGS += -MP -MMD
CFLAGS += $(with)
CFLAGS += $(defn)
# auto dependency generation above (remember to add to clean:)
SOURCES := $(wildcard $(SRCDIR)/*.c)
INCLUDES := $(wildcard $(SRCDIR)/*.h)
OBJECTS := $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
# linking
CCLD := $(CC)
LDFLAGS := `pkg-config --libs gtk+-2.0`
LDFLAGS += `pkg-config --libs gtksourceview-2.0`
LIBS :=
# conditional naming, includes and libraries for windows
ifeq ($(ss),-DWIN)
APPNAME := $(APPNAME).exe
SYMNAME := $(SYMNAME).exe
LIBS += -Wl,-subsystem,windows
endif
$(APPNAME): $(OBJECTS)
@mkdir -p $(@D)/bin
$(CCLD) -o $(BINDIR)/$(SYMNAME) $(OBJECTS) $(CFLAGS) $(LDFLAGS) $(LIBS)
strip -s -o $(BINDIR)/$(APPNAME) $(BINDIR)/$(SYMNAME)
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
@mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) $(DEFS) -c -o $@ $<
clean:
rm -rf $(BINDIR) $(OBJDIR)