From b340f83e155d67ccb1e5421b1e8f4d01adefa1a1 Mon Sep 17 00:00:00 2001 From: Alexey Pelykh Date: Sat, 16 Jun 2012 09:14:34 +0300 Subject: [PATCH] Fix makefiles --- Osmand-kernel/Makefile.rules | 40 +++++++++++++++++++++------------- Osmand-kernel/build/.gitignore | 2 ++ Osmand-kernel/expat/Common.mk | 2 +- 3 files changed, 28 insertions(+), 16 deletions(-) create mode 100755 Osmand-kernel/build/.gitignore diff --git a/Osmand-kernel/Makefile.rules b/Osmand-kernel/Makefile.rules index 7739bea6c7..ac2ee34d58 100755 --- a/Osmand-kernel/Makefile.rules +++ b/Osmand-kernel/Makefile.rules @@ -12,8 +12,8 @@ CFLAGS_debug := -g -O0 CXXFLAGS_release := -O2 CFLAGS_release := -O2 -# Get the build type -PREBUILT_DIR_PREFIX = ../lib/$(TARGET)-$(ARCH) +OUTPUT_DIR_PREFIX = ../lib/$(TARGET)-$(ARCH) +BUILD_DIR_PREFIX = ../build/$(TARGET)-$(ARCH) OBJECTS_NAMES = $(foreach sourceFilesExt,$(CC_SOURCE_FILES_EXTS), \ $(patsubst %.$(sourceFilesExt),%.$(sourceFilesExt).cc.o,$(filter %.$(sourceFilesExt),$(LOCAL_SRC_FILES))) \ @@ -22,20 +22,20 @@ OBJECTS_NAMES = $(foreach sourceFilesExt,$(CC_SOURCE_FILES_EXTS), \ ) OBJECTS = $(addprefix obj-$(TARGET)-$(ARCH)/,$(OBJECTS_NAMES)) +# Declare phony targets +.PHONY: release debug clean installr installd install-release-$(DYNAMICLIB_EXT) install-debug-$(DYNAMICLIB_EXT) install-release-$(STATICLIB_EXT) install-debug-$(STATICLIB_EXT) + # Default target .DEFAULT: installr -# Declare phony targets -.PHONY: release debug clean installr installd - # Precious targets .PRECIOUS: build-release/$(LIBNAME).$(LIBTYPE) build-debug/$(LIBNAME).$(LIBTYPE) $(addprefix build-release/,$(OBJECTS)) $(addprefix build-debug/,$(OBJECTS)) # Route build targets properly -installr: install-release -installd: install-debug -release: build-release/$(TARGET)-$(ARCH)/$(LIBNAME).$(LIBTYPE) -debug: build-debug/$(TARGET)-$(ARCH)/$(LIBNAME).$(LIBTYPE) +installr: release $(OUTPUT_DIR_PREFIX)-release/$(LIBNAME).$(LIBTYPE) +installd: debug $(OUTPUT_DIR_PREFIX)-debug/$(LIBNAME).$(LIBTYPE) +release: $(BUILD_DIR_PREFIX)-release/$(LIBNAME).$(LIBTYPE) +debug: $(BUILD_DIR_PREFIX)-debug/$(LIBNAME).$(LIBTYPE) # Clean removes all objects clean: @@ -43,12 +43,17 @@ clean: $(RM) -r build-debug/obj-$(TARGET)-$(ARCH)/ $(RM) -r build-release/$(TARGET)-$(ARCH) $(RM) -r build-debug/$(TARGET)-$(ARCH) - $(RM) $(PREBUILT_DIR_PREFIX)/$(LIBNAME).$(LIBTYPE) + $(RM) -r $(BUILD_DIR_PREFIX)-release + $(RM) -r $(BUILD_DIR_PREFIX)-debug + $(RM) $(OUTPUT_DIR_PREFIX)-release/$(LIBNAME).$(LIBTYPE) + $(RM) $(OUTPUT_DIR_PREFIX)-debug/$(LIBNAME).$(LIBTYPE) -# This target copies final output file to prebuilt folder -install-%: % - @mkdir -p $(PREBUILT_DIR_PREFIX)-$* - cp build-$*/$(TARGET)-$(ARCH)/$(LIBNAME).$(LIBTYPE) $(PREBUILT_DIR_PREFIX)-$*/$(LIBNAME).$(LIBTYPE) +# This target copies final output file to output directory +$(OUTPUT_DIR_PREFIX)-%/$(LIBNAME).$(DYNAMICLIB_EXT): $(BUILD_DIR_PREFIX)-%/$(LIBNAME).$(LIBTYPE) + @mkdir -p $(OUTPUT_DIR_PREFIX)-$* + cp $(BUILD_DIR_PREFIX)-$*/$(LIBNAME).$(LIBTYPE) $(OUTPUT_DIR_PREFIX)-$*/$(LIBNAME).$(LIBTYPE) + +$(OUTPUT_DIR_PREFIX)-%/$(LIBNAME).$(STATICLIB_EXT): # Builds source files using CC compiler build-release/obj-$(TARGET)-$(ARCH)/%.cc.o : % $(LOCAL_C_INCLUDES) @@ -76,4 +81,9 @@ build-%/$(TARGET)-$(ARCH)/$(LIBNAME).$(STATICLIB_EXT): $$(addprefix build-%/,$(O .SECONDEXPANSION: build-%/$(TARGET)-$(ARCH)/$(LIBNAME).$(DYNAMICLIB_EXT): $$(addprefix build-%/,$(OBJECTS)) @mkdir -p `dirname $@` - $(CXX) -o $@ $(addprefix build-$*/,$(OBJECTS)) $(LDFLAGS) -L$(PREBUILT_DIR_PREFIX)-$* $(LDLIBS) \ No newline at end of file + $(CXX) -o $@ $(addprefix build-$*/,$(OBJECTS)) $(LDFLAGS) -L$(BUILD_DIR_PREFIX)-$* $(LDLIBS) + +# This is for copying binary files to build directory +$(BUILD_DIR_PREFIX)-%/$(LIBNAME).$(LIBTYPE): build-%/$(TARGET)-$(ARCH)/$(LIBNAME).$(LIBTYPE) + @mkdir -p $(BUILD_DIR_PREFIX)-$* + cp build-$*/$(TARGET)-$(ARCH)/$(LIBNAME).$(LIBTYPE) $(BUILD_DIR_PREFIX)-$*/$(LIBNAME).$(LIBTYPE) \ No newline at end of file diff --git a/Osmand-kernel/build/.gitignore b/Osmand-kernel/build/.gitignore new file mode 100755 index 0000000000..c96a04f008 --- /dev/null +++ b/Osmand-kernel/build/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/Osmand-kernel/expat/Common.mk b/Osmand-kernel/expat/Common.mk index 642c46cf45..9ecd3535f9 100644 --- a/Osmand-kernel/expat/Common.mk +++ b/Osmand-kernel/expat/Common.mk @@ -6,7 +6,7 @@ LOCAL_C_INCLUDES += \ $(OSMAND_EXPAT_ABS) \ $(OSMAND_EXPAT_ABS)/lib -LOCAL_CFLAGS += -fPIC -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H +LOCAL_CFLAGS += -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H LOCAL_SRC_FILES := \ $(OSMAND_EXPAT_LOC)/lib/xmlparse.c \