make: Add projects.mk and prefixed win32 objects with win32-

- Add new makefile projects.mk, which is the place to define the minimally
  required set of variables to get a project's makefile oriented about
  the build machinery itself, mostly its locations in the file system. This
  also includes querying other projects. It's been pushed into a seperate
  makefile includeable early in the Makefile hierarchy, so that other
  special build variables (i.e. TARGET) can be specialized from within the
  project later to define build characteristics.
- Prefixed object files with $(FLAVOUR_PREFIX), to allow for building two
  targets from the same directory

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2016-12-25 13:45:12 +00:00
commit cb1e735f9c
5 changed files with 42 additions and 34 deletions

View file

@ -4,28 +4,26 @@
ifndef YTOOLS_DEF_MK_INCLUDED
YTOOLS_DEF_MK_INCLUDED = true
include $(MODDIR)/make/platform.mk
include $(MODDIR)/make/projects.mk
ifeq ($(MAKE_BENCHMARK),true)
SHELL = $(MOD_SCRIPT_DIR)/timed-make-shell.sh
SHELL = $(MOD_SCRIPT_DIR)/timed-make-shell.sh
endif
proj_query = $(shell python $(MOD_SCRIPT_DIR)/projects.py -p $(PROJECTS_DIR) -t $(TOPDIR) $(PROJECTS_PY_EXTRA_ARGS) $(1))
proj_dir = $(call proj_query,proj-dir $(1))
htdocs_dir = $(call proj_query,htdocs-dir $(1))
# ----- pre-local.mk
ifneq ($(wildcard $(MODDIR)/make/pre-local.mk),)
include $(MODDIR)/make/pre-local.mk
include $(MODDIR)/make/pre-local.mk
endif
ifneq ($(wildcard $(TOPDIR)/make/pre-local.mk),)
include $(TOPDIR)/make/pre-local.mk
include $(TOPDIR)/make/pre-local.mk
endif
ifneq ($(wildcard pre-local.mk),)
include pre-local.mk
include pre-local.mk
endif
# ----- executables
@ -35,14 +33,10 @@ SHELL ?= /bin/bash
BROWSER ?= firefox
# ----- standard variables
ifeq ($(PROJECT),)
PROJECT := $(patsubst $(FLAVOUR_PREFIX)%,%,$(notdir $(shell cd $(TOPDIR); pwd | $(SED) 's/.*\///; s/-[0-9].*//')))
endif
CVSTOPDIR ?= $(CVS_PROJ_DIR)/..
ifeq ($(PROJECT),ytools)
MOD_SCRIPT_DIR ?= $(MODDIR)/devutil/scripts
else
MOD_SCRIPT_DIR ?= $(firstword $(wildcard $(MODDIR)/devutil/scripts $(MODDIR)/bin))
ifeq ($(PROJECT),)
PROJECT := $(patsubst $(FLAVOUR_PREFIX)%,%,$(notdir $(shell cd $(TOPDIR); pwd | $(SED) 's/.*\///; s/-[0-9].*//')))
endif
OS ?= $(shell sh $(MOD_SCRIPT_DIR)/get_os.sh)
@ -81,9 +75,6 @@ ifeq ($(PKG_FORMAT),debian)
export INCLUDE_REV_IN_VERSIONS = true
endif
CVS_PROJ_DIR ?= $(TOPDIR)/..
CVSTOPDIR ?= $(CVS_PROJ_DIR)/..
PROJECT_DESCR_FILE ?= $(wildcard $(TOPDIR)/make/project.conf)
PROJECT_SHORT_NAME ?= $(PROJECT)
PROJECT_CAPNAME = $(shell echo $(PROJECT) | tr [a-z] [A-Z] | $(SED) 's/-/_/g')
@ -97,7 +88,6 @@ CREATE_DEVEL = false
endif
endif
VERSION_FILE ?= $(firstword $(wildcard VERSION $(TOPDIR)/VERSION))
VERSION := $(shell $(CAT) $(VERSION_FILE))
DIST_VERSION ?= $(shell $(SED) -e "s/-dev//" $(VERSION_FILE))
HEX_VERSION = $(shell echo $(DIST_VERSION) | \
@ -166,7 +156,6 @@ JANWARE_URL_DOC_PROJECT ?= https://janware.com/wiki/$(JANWARE_WIKI)/assets:
PKG_VENDOR ?= janware GmbH
FULL_NAME ?= $(shell id -nu | xargs getent passwd | cut -d: -f5)
DEVELOPMENT ?= $(shell echo $(VERSION) | grep -q 'dev' && echo true)
USE_PROJECT_LIB ?= true
EXPORT_PROJECT_LIB ?= $(USE_PROJECT_LIB)
USE_YTOOLS ?= true
@ -303,8 +292,8 @@ ALL_H += $(LOCAL_H) $(PREREQ_H)
SRC_ALL_CPP += $(LOCAL_C) $(LOCAL_CPP) $(LOCAL_H)
SRC_C += $(filter %.c, $(SRC_ALL_CPP))
SRC_CPP += $(filter %.cc %.cpp %.C, $(SRC_ALL_CPP))
OBJ += $(patsubst %.C,%.o,$(patsubst %.cpp,%.o,$(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(filter %.c %.cpp %.cc %.C, $(SRC_ALL_CPP))))))
OBJ += $(patsubst %.S,%.o,$(SFILES))
OBJ += $(addprefix $(FLAVOUR_PREFIX),$(patsubst %.C,%.o,$(patsubst %.cpp,%.o,$(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(filter %.c %.cpp %.cc %.C, $(SRC_ALL_CPP)))))))
OBJ += $(addprefix $(FLAVOUR_PREFIX),$(patsubst %.S,%.o,$(SFILES)))
#PREREQ_DIR += $(addprefix $(MODDIR)/,$(LOCAL_PREREQ))
#PREREQ_DONE += $(addsuffix /all.done,$(PREREQ_DIR))