diff options
| author | Christopher Li <sparse@chrisli.org> | 2017-07-15 22:48:13 -0400 |
|---|---|---|
| committer | Christopher Li <sparse@chrisli.org> | 2017-08-09 21:56:31 -0400 |
| commit | fb8734e3fa18619277f54f131a9b898ce7171645 (patch) | |
| tree | eb4362d9f6c1625a60f258dc9315f24ac79e50ed /Makefile | |
| parent | 36b6ed7efeab5eaefc37db292391da23d9c5014e (diff) | |
| download | sparse-dev-fb8734e3fa18619277f54f131a9b898ce7171645.tar.gz | |
Makefile: clean up and simplify
- For invoke shell command, use immediate evaluation to avoid
invoke more than once.
- Adding header file dependency to all object files. Remove the
hand specify header file dependency.
- Change c2xml to target specific CFLAGS, this allow c2xml using
the common pattern rules.
- Ramsay Jones point out that LIBXML_CFLAGS need to be put into
if HAVE_LIBXML condition. Otherwise make will spew error on
system that does not have libxml
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-By: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -34,10 +34,10 @@ HAVE_GTK2:=$(shell $(PKG_CONFIG) --exists gtk+-2.0 2>/dev/null && echo 'yes') LLVM_CONFIG:=llvm-config HAVE_LLVM:=$(shell $(LLVM_CONFIG) --version >/dev/null 2>&1 && echo 'yes') -GCC_BASE = $(shell $(CC) --print-file-name=) +GCC_BASE := $(shell $(CC) --print-file-name=) BASIC_CFLAGS = -DGCC_BASE=\"$(GCC_BASE)\" -MULTIARCH_TRIPLET = $(shell $(CC) -print-multiarch 2>/dev/null) +MULTIARCH_TRIPLET := $(shell $(CC) -print-multiarch 2>/dev/null) BASIC_CFLAGS += -DMULTIARCH_TRIPLET=\"$(MULTIARCH_TRIPLET)\" ifeq ($(HAVE_GCC_DEP),yes) @@ -62,6 +62,7 @@ ifeq ($(HAVE_LIBXML),yes) PROGRAMS+=c2xml INST_PROGRAMS+=c2xml c2xml_EXTRA_OBJS = `$(PKG_CONFIG) --libs libxml-2.0` +LIBXML_CFLAGS := $(shell $(PKG_CONFIG) --cflags libxml-2.0) else $(warning Your system does not have libxml, disabling c2xml) endif @@ -187,17 +188,14 @@ $(SLIB_FILE): $(LIB_OBJS) $(QUIET_LINK)$(CC) $(LDFLAGS) -Wl,-soname,$@ -shared -o $@ $(LIB_OBJS) DEP_FILES := $(wildcard .*.o.d) -$(if $(DEP_FILES),$(eval include $(DEP_FILES))) -c2xml.o: c2xml.c $(LIB_H) - $(QUIET_CC)$(CC) `$(PKG_CONFIG) --cflags libxml-2.0` -o $@ -c $(ALL_CFLAGS) $< +ifneq ($(DEP_FILES),) +include $(DEP_FILES) +endif -compat-linux.o: compat/strtold.c compat/mmap-blob.c $(LIB_H) -compat-solaris.o: compat/mmap-blob.c $(LIB_H) -compat-mingw.o: $(LIB_H) -compat-cygwin.o: $(LIB_H) +c2xml.o: CFLAGS += $(LIBXML_CFLAGS) -%.o: %.c +%.o: %.c $(LIB_H) $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< clean: clean-check |
