From a92915a90687b990b6175fb13f1fb89b28bee816 Mon Sep 17 00:00:00 2001 From: David Herberth Date: Tue, 13 Dec 2011 13:56:54 +0100 Subject: [PATCH] makefile update --- Makefile | 43 +++++++++++++++++----------------- command.make | 66 ++++++++++++++++++++++++++-------------------------- 2 files changed, 54 insertions(+), 55 deletions(-) diff --git a/Makefile b/Makefile index 09aaa8c..7187588 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ define make-lib $(RANLIB) $(DLIB_PATH)$(PATH_SEP)$@ endef -############# BUILD ############# +############# BUILD ############# all: static-lib header doc pkgfile @echo ------------------ Building $^ done @@ -82,32 +82,32 @@ $(SONAME): $(PICOBJECTS) # create object files $(BUILD_PATH)$(PATH_SEP)%.o : %.d - $(DC) $(DFLAGS) $(DFLAGS_LINK) $(DFLAGS_IMPORT) -c $< $(OUTPUT)$@ + $(DC) $(DCFLAGS) $(DCFLAGS_LINK) $(DCFLAGS_IMPORT) -c $< $(OUTPUT)$@ # create shared object files $(BUILD_PATH)$(PATH_SEP)%.pic.o : %.d - $(DC) $(DFLAGS) $(DFLAGS_LINK) $(FPIC) $(DFLAGS_IMPORT) -c $< $(OUTPUT)$@ + $(DC) $(DCFLAGS) $(DCFLAGS_LINK) $(FPIC) $(DCFLAGS_IMPORT) -c $< $(OUTPUT)$@ # Generate Header files $(IMPORT_PATH)$(PATH_SEP)%.di : %.d - $(DC) $(DFLAGS) $(DFLAGS_LINK) $(DFLAGS_IMPORT) -c $(NO_OBJ) $< $(HF)$@ + $(DC) $(DCFLAGS) $(DCFLAGS_LINK) $(DCFLAGS_IMPORT) -c $(NO_OBJ) $< $(HF)$@ # Generate Documentation $(DOC_PATH)$(PATH_SEP)%.html : %.d - $(DC) $(DFLAGS) $(DFLAGS_LINK) $(DFLAGS_IMPORT) -c $(NO_OBJ) $< $(DF)$@ + $(DC) $(DCFLAGS) $(DCFLAGS_LINK) $(DCFLAGS_IMPORT) -c $(NO_OBJ) $< $(DF)$@ # Generate ddoc Documentation $(DDOC_PATH)$(PATH_SEP)%.html : %.d - $(DC) $(DFLAGS) $(DFLAGS_LINK) $(DFLAGS_IMPORT) -c $(NO_OBJ) $(DDOC_FLAGS) $< $(DF)$@ + $(DC) $(DCFLAGS) $(DCFLAGS_LINK) $(DCFLAGS_IMPORT) -c $(NO_OBJ) $(DDOC_FLAGS) $< $(DF)$@ -############# CLEAN ############# +############# CLEAN ############# clean: clean-objects clean-static-lib clean-doc clean-header clean-pkgfile @echo ------------------ Cleaning $^ done clean-objects: $(RM) $(OBJECTS) @echo ------------------ Cleaning objects done - + clean-shared-objects: $(RM) $(PICOBJECTS) @echo ------------------ Cleaning shared-object done @@ -115,20 +115,20 @@ clean-shared-objects: clean-static-lib: $(RM) $(SONAME) @echo ------------------ Cleaning static-lib done - + clean-shared-lib: $(RM) $(LIBNAME) @echo ------------------ Cleaning shared-lib done - + clean-header: $(RM) $(HEADERS) @echo ------------------ Cleaning header done - + clean-doc: $(RM) $(DOCUMENTATIONS) $(RM) $(DOC_PATH) @echo ------------------ Cleaning doc done - + clean-ddoc: $(RM) $(DDOC_PATH)$(PATH_SEP)index.html $(RM) $(DDOC_PATH) @@ -141,9 +141,9 @@ clean-geany-tag: clean-pkgfile: $(RM) $(PKG_CONFIG_FILE) @echo ------------------ Cleaning pkgfile done - + ############# INSTALL ############# - + install: install-static-lib install-doc install-header install-pkgfile @echo ------------------ Installing $^ done @@ -156,21 +156,20 @@ install-shared-lib: $(MKDIR) $(LIB_DIR) $(CP) $(DLIB_PATH)$(PATH_SEP)$(SONAME) $(LIB_DIR) @echo ------------------ Installing shared-lib done - + install-header: $(MKDIR) $(INCLUDE_DIR) - $(CP) $(IMPORT_PATH) $(INCLUDE_DIR) + $(CP) $(IMPORT_PATH)$(PATH_SEP)* $(INCLUDE_DIR) @echo ------------------ Installing header done - + install-doc: $(MKDIR) $(DATA_DIR)$(PATH_SEP)doc$(PATH_SEP)$(PROJECT_NAME)$(PATH_SEP)normal_doc$(PATH_SEP) - $(CP) $(DOC_PATH)$(PATH_SEP)$(PROJECT_NAME)$(PATH_SEP)* $(DATA_DIR)$(PATH_SEP)doc$(PATH_SEP)$(PROJECT_NAME)$(PATH_SEP)normal_doc$(PATH_SEP) + $(CP) $(DOC_PATH)$(PATH_SEP)* $(DATA_DIR)$(PATH_SEP)doc$(PATH_SEP)$(PROJECT_NAME)$(PATH_SEP)normal_doc$(PATH_SEP) @echo ------------------ Installing doc done - + install-ddoc: $(MKDIR) $(DATA_DIR)$(PATH_SEP)doc$(PATH_SEP)$(PROJECT_NAME)$(PATH_SEP)cute_doc$(PATH_SEP) - $(CP) $(DDOC_PATH)$(PATH_SEP)$(PROJECT_NAME)$(PATH_SEP)* $(DATA_DIR)$(PATH_SEP)doc$(PATH_SEP)$(PROJECT_NAME)$(PATH_SEP)cute_doc$(PATH_SEP) - $(CP) $(DDOC_PATH)$(PATH_SEP)index.html $(DATA_DIR)$(PATH_SEP)doc$(PATH_SEP)$(PROJECT_NAME)$(PATH_SEP)cute_doc$(PATH_SEP) + $(CP) $(DDOC_PATH)$(PATH_SEP)* $(DATA_DIR)$(PATH_SEP)doc$(PATH_SEP)$(PROJECT_NAME)$(PATH_SEP)cute_doc$(PATH_SEP) @echo ------------------ Installing ddoc done install-geany-tag: @@ -181,4 +180,4 @@ install-geany-tag: install-pkgfile: $(MKDIR) $(PKGCONFIG_DIR) $(CP) $(PKG_CONFIG_FILE) $(PKGCONFIG_DIR) - @echo ------------------ Installing pkgfile done + @echo ------------------ Installing pkgfile done \ No newline at end of file diff --git a/command.make b/command.make index 9c32da6..839bab5 100644 --- a/command.make +++ b/command.make @@ -27,7 +27,7 @@ else message = @(echo \033[31m $1 \033[0;0m1) endif endif - + # Define command for copy, remove and create file/dir ifeq ($(OS),"Windows") RM = del /Q @@ -45,7 +45,7 @@ else ifeq ($(OS),"Darwin") MKDIR = mkdir -p MV = mv endif - + # If compiler is not define try to find it ifndef DC ifneq ($(strip $(shell which dmd 2>/dev/null)),) @@ -58,18 +58,18 @@ ifndef DC DC=gdc endif endif - + # Define flag for gdc other ifeq ($(DC),gdc) - DFLAGS = -O2 -fdeprecated - LINKERFLAG= -Xlinker + DCFLAGS = -O2 -fdeprecated + LINKERFLAG= -Xlinker OUTPUT = -o HF = -fintfc-file= DF = -fdoc-file= NO_OBJ = -fsyntax-only DDOC_MACRO= -fdoc-inc= else - DFLAGS = -O -d + DCFLAGS = -O -d LINKERFLAG= -L OUTPUT = -of HF = -Hf @@ -77,7 +77,7 @@ else NO_OBJ = -o- DDOC_MACRO= endif - + #define a suufix lib who inform is build with which compiler ifeq ($(DC),gdc) COMPILER=gdc @@ -94,19 +94,19 @@ else ifeq ($(DC),dmd) else ifeq ($(DC),dmd2) COMPILER=dmd endif - + # Define relocation model for ldc or other ifneq (,$(findstring ldc,$(DC))) FPIC = -relocation-model=pic else FPIC = -fPIC endif - + # Add -ldl flag for linux ifeq ($(OS),"Linux") - LDFLAGS += $(LINKERFLAG)-ldl + LDCFLAGS += $(LINKERFLAG)-ldl endif - + # If model are not gieven take the same as current system ARCH = $(shell arch || uname -m) ifndef MODEL @@ -116,18 +116,18 @@ ifndef MODEL MODEL = 32 endif endif - + ifeq ($(MODEL), 64) - DFLAGS += -m64 - LDFLAGS += -m64 + DCFLAGS += -m64 + LDCFLAGS += -m64 else - DFLAGS += -m32 - LDFLAGS += -m32 + DCFLAGS += -m32 + LDCFLAGS += -m32 endif - + # Define var PREFIX, BIN_DIR, LIB_DIR, INCLUDE_DIR, DATA_DIR ifndef PREFIX - ifeq ($(OS),"Windows") + ifeq ($(OS),"Windows") PREFIX = $(PROGRAMFILES) else ifeq ($(OS), "Linux") PREFIX = /usr/local @@ -137,7 +137,7 @@ ifndef PREFIX endif ifndef BIN_DIR - ifeq ($(OS), "Windows") + ifeq ($(OS), "Windows") BIN_DIR = $(PROGRAMFILES)\$(PROJECT_NAME)\bin else ifeq ($(OS), "Linux") BIN_DIR = $(PREFIX)/bin @@ -146,7 +146,7 @@ ifndef BIN_DIR endif endif ifndef LIB_DIR - ifeq ($(OS), "Windows") + ifeq ($(OS), "Windows") LIB_DIR = $(PREFIX)\$(PROJECT_NAME)\lib else ifeq ($(OS), "Linux") LIB_DIR = $(PREFIX)/lib @@ -156,7 +156,7 @@ ifndef LIB_DIR endif ifndef INCLUDE_DIR - ifeq ($(OS), "Windows") + ifeq ($(OS), "Windows") INCLUDE_DIR = $(PROGRAMFILES)\$(PROJECT_NAME)\import else ifeq ($(OS), "Linux") INCLUDE_DIR = $(PREFIX)/include/d/$(PROJECT_NAME) @@ -166,7 +166,7 @@ ifndef INCLUDE_DIR endif ifndef DATA_DIR - ifeq ($(OS), "Windows") + ifeq ($(OS), "Windows") DATA_DIR = $(PROGRAMFILES)\$(PROJECT_NAME)\data else ifeq ($(OS), "Linux") DATA_DIR = $(PREFIX)/share @@ -176,7 +176,7 @@ ifndef DATA_DIR endif ifndef PKGCONFIG_DIR - ifeq ($(OS), "Windows") + ifeq ($(OS), "Windows") PKGCONFIG_DIR = $(PROGRAMFILES)\$(PROJECT_NAME)\data else ifeq ($(OS), "Linux") PKGCONFIG_DIR = $(DATA_DIR)/pkgconfig @@ -184,20 +184,20 @@ ifndef PKGCONFIG_DIR PKGCONFIG_DIR = $(DATA_DIR)/pkgconfig endif endif - + ifndef CC CC = gcc endif - + DLIB_PATH = ./lib IMPORT_PATH = ./import DOC_PATH = ./doc DDOC_PATH = ./ddoc BUILD_PATH = ./build - -DFLAGS_IMPORT = -DFLAGS_LINK = $(LDFLAGS) - + +DCFLAGS_IMPORT = -I"gl3n/" +DCFLAGS_LINK = $(LDCFLAGS) + LIBNAME = lib$(PROJECT_NAME)-$(COMPILER)$(STATIC_LIB_EXT) SONAME = lib$(PROJECT_NAME)-$(COMPILER)$(DYNAMIC_LIB_EXT) @@ -219,9 +219,9 @@ export CP export DATA_DIR export DC export DF -export DFLAGS -export DFLAGS_IMPORT -export DFLAGS_LINK +export DCFLAGS +export DCFLAGS_IMPORT +export DCFLAGS_LINK export DLIB_PATH export DOC_PATH export DDOC_PATH @@ -230,7 +230,7 @@ export FixPath export HF export INCLUDE_DIR export IMPORT_PATH -export LDFLAGS +export LDCFLAGS export FPIC export LIBNAME export LIB_DIR