Makefile: add all rule

This commit is contained in:
Mathieu Maret 2017-06-12 15:25:31 +02:00
parent 601995f889
commit 023c2ae85b

View File

@ -18,7 +18,6 @@ lib = libexample.so
lib_src = lib.c
lib_obj = $(lib_src:%.c=%.o)
lib_dep = $(lib_src:%.c=%.d)
$(info $$lib_obj is ${lib_obj})
sources = $(filter-out $(lib_src), $(wildcard *.c))
objects = $(sources:%.c=%.o)
@ -29,18 +28,19 @@ cxx_sources = $(wildcard *.cpp)
cxx_objects = $(cxx_sources:%.cpp=%.o)
cxx_depends = $(cxx_sources:%.cpp=%.d)
all: $(bin) $(cxxbin) $(lib)
$(bin): $(objects)
$(cxxbin) : $(cxx_objects)
$(lib): CFLAGS += -fpic
$(lib): $(lib_obj)
# C++ compilation (Use implicit LINK.CC)
$(cxxbin):
$(LINK.cc) $^ $(LDLIBS) -o $@
$(lib): CFLAGS += -fpic
$(lib): $(lib_obj)
%.so:
$(LINK.c) -shared $^ $(LDLIBS) -o $@