@@ -10,6 +10,10 @@ $(info Building for PLATFORM=$(PLATFORM))
1010
1111include $(MWD ) /../Makefile
1212
13+ # Add GIT_VERSION macro define to CFLAGS, includes tag if available,
14+ # short commit hash, appends '*' if changes haven't been commited
15+ CFLAGS += -DGIT_VERSION='\"$(shell git rev-parse --short HEAD)$(shell git status --porcelain | grep -q '^[ MADRCU]' && echo '* ') \"'
16+
1317IS_LIBRARY := $(if $(filter % .lib,$(PRODUCT ) ) ,1,0)
1418ifeq ($(IS_LIBRARY ) ,1)
1519 PRODUCT_BASE = $(basename $(PRODUCT ) )
@@ -33,6 +37,10 @@ ifneq ($(strip $(LD_$(TOOLCHAIN_UC))),)
3337LD_DEFAULT = $(LD_$(TOOLCHAIN_UC ) )
3438endif
3539
40+ ifneq ($(strip $(PC_$(TOOLCHAIN_UC ) ) ) ,)
41+ PC_DEFAULT = $(PC_$(TOOLCHAIN_UC ) )
42+ endif
43+
3644R2R_PD := $(R2R_DIR ) /$(PLATFORM )
3745OBJ_DIR := $(BUILD_DIR ) /$(PLATFORM )
3846CACHE_PLATFORM := $(CACHE_DIR ) /$(PLATFORM )
@@ -60,16 +68,16 @@ SRC_DIRS_EXPANDED := $(call expand_platform_pattern,$(SRC_DIRS))
6068CFILES := $(foreach dir,$(SRC_DIRS_EXPANDED ) ,$(wildcard $(dir ) /* .c) )
6169AFILES := $(foreach dir,$(SRC_DIRS_EXPANDED ) ,$(wildcard $(dir ) /* .s) ) \
6270 $(foreach dir,$(SRC_DIRS_EXPANDED ) ,$(wildcard $(dir ) /* .asm) )
71+ PFILES := $(foreach dir,$(SRC_DIRS_EXPANDED ) ,$(wildcard $(dir ) /* .pas) )
6372
6473# Need two steps: AFILES may be .s or .asm; `make` swaps one suffix at a time
6574NORM_AFILES := $(AFILES:.asm=.s )
66- OBJS := $(addprefix $(OBJ_DIR ) /, $(notdir $(CFILES:.c=.o ) $(NORM_AFILES:.s=.o ) ) )
75+ OBJS := $(addprefix $(OBJ_DIR ) /, $(notdir $(CFILES:.c=.o ) $(NORM_AFILES:.s=.o ) $( PFILES:.pas=.o ) ) )
6776
6877$(BUILD_EXEC ) :: $(OBJS ) $(EXECUTABLE_EXTRA_DEPS_$(PLATFORM_UC ) ) | $(R2R_PD )
6978 $(call link-bin,$@ ,$(OBJS ) )
7079 @$(MAKE ) -f $(PLATFORM_MK ) $(PLATFORM ) /executable-post
7180
72- $(info LIBRARY=$(BUILD_LIB))
7381$(BUILD_LIB ) :: $(OBJS ) $(LIBRARY_EXTRA_DEPS_$(PLATFORM_UC ) ) | $(R2R_PD )
7482 $(call link-lib,$@ ,$(OBJS ) )
7583 @$(MAKE ) -f $(PLATFORM_MK ) $(PLATFORM ) /library-post
@@ -85,10 +93,13 @@ $(OBJ_DIR)/%.o: %.s | $(OBJ_DIR)
8593 $(call assemble,$@ ,$< )
8694$(OBJ_DIR ) /% .o : % .asm | $(OBJ_DIR )
8795 $(call assemble,$@ ,$< )
96+ $(OBJ_DIR ) /% .o : % .pas | $(OBJ_DIR )
97+ $(call compile-pas,$@ ,$< )
8898
8999vpath % .c $(SRC_DIRS_EXPANDED )
90100vpath % .s $(SRC_DIRS_EXPANDED )
91101vpath % .asm $(SRC_DIRS_EXPANDED )
102+ vpath % .pas $(SRC_DIRS_EXPANDED )
92103
93104.PHONY : clean debug r2r $(PLATFORM ) /r2r disk $(PLATFORM ) /disk
94105
0 commit comments