-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (31 loc) · 903 Bytes
/
Makefile
File metadata and controls
31 lines (31 loc) · 903 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
31
PROJECT := barelib
PROJECT_NAMESPACE := bare
VERSION := 0.0.0
include maketools/config.mk
CFLAGS += -Iinclude -DBARELIB_VERSION=\"$(VERSION)\"
EXTRA_LD += -l$(PROJECT)
EXDIR = examples
LIB_SRCS := $(wildcard src/*.c)
LIB_OBJS := $(patsubst src/%.c,$(OBJDIR)/%.o,$(LIB_SRCS))
EXAMPLE_SRCS := $(wildcard examples/*.c)
EXAMPLE_BINS := $(patsubst examples/%.c,$(BINDIR)/%,$(EXAMPLE_SRCS))
BINARIES := $(EXAMPLE_BINS)
.PHONY: all lib examples clean debug release install uninstall
SHARED ?= 0
TARGETS := $(LIBDIR)/lib$(PROJECT).a
ifeq ($(SHARED),1)
TARGETS += $(LIBDIR)/lib$(PROJECT).so
endif
all: lib examples
lib: $(TARGETS)
ifneq ($(EXAMPLE_SRCS),)
examples: lib $(EXAMPLE_BINS)
else
examples: lib
endif
debug release:
$(MAKE) BUILD=$@ all
include maketools/build.mk
include maketools/install.mk
install: install-lib install-bin
uninstall: uninstall-lib uninstall-bin