diff --git a/Makefile b/Makefile index 5779d9d..ddf3953 100644 --- a/Makefile +++ b/Makefile @@ -68,8 +68,7 @@ distclean: clean SOURCES = $(SRC)/xchange.c $(SRC)/xstruct.c $(SRC)/xlookup.c $(SRC)/xjson.c # Generate a list of object (obj/*.o) files from the input sources -OBJECTS := $(subst $(SRC),$(OBJ),$(SOURCES)) -OBJECTS := $(subst .c,.o,$(OBJECTS)) +OBJECTS := $(subst .c,.o,$(subst $(SRC),$(OBJ),$(SOURCES))) $(LIB)/libxchange.so: $(LIB)/libxchange.so.$(SO_VERSION) diff --git a/build.mk b/build.mk index 765cb4e..c2c7af3 100644 --- a/build.mk +++ b/build.mk @@ -3,11 +3,10 @@ # Generic build targets and recipes for xchange. # # You can include this in your Makefile also. -# ============================================================================ - # Regular object files -$(OBJ)/%.o: %.c dep/%.d $(OBJ) Makefile + +$(OBJ)/%.o: %.c $(OBJ) Makefile $(CC) -o $@ -c $(CPPFLAGS) $(CFLAGS) $< # Share library recipe @@ -27,13 +26,13 @@ $(LIB)/%.a: ranlib $@ # Create sub-directories for build targets -dep $(OBJ) $(LIB) $(BIN) apidoc: +$(OBJ) $(LIB) $(BIN) apidoc: mkdir $@ # Remove intermediate files locally .PHONY: clean-local clean-local: - rm -rf obj dep + rm -rf obj # Remove all locally built files, effectively restoring the repo to its # pristine state @@ -61,11 +60,4 @@ dox: README.md Doxyfile apidoc $(SRC) $(INC) @echo " [doxygen]" @$(DOXYGEN) -# Automatic dependence on included header files. -.PRECIOUS: dep/%.d -dep/%.d: $(SRC)/%.c dep - @echo " > $@" \ - && $(CC) $(CPPFLAGS) -MM -MG $< > $@.$$$$ \ - && sed 's|\w*\.o[ :]*| $(OBJ)/&|g' < $@.$$$$ > $@; \ - rm -f $@.$$$$