mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 10:07:38 -04:00
skin_parser: Modernize Makefile.
- Avoid use of uname, instead ask the compiler about the binaries it creates. - Move platform specific commands used into functions. - Replace use of echo with make functions. Change-Id: I365f656e02ddb90ee91ae60fec1230b4aaaf224f
This commit is contained in:
parent
db350ac3e2
commit
5f5e44f593
1 changed files with 17 additions and 10 deletions
|
@ -15,9 +15,18 @@ AR ?= ar
|
|||
OUTPUT=libskin_parser
|
||||
TARGET_DIR ?= ./
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
mkdir = if not exist $(subst /,\,$(1)) mkdir $(subst /,\,$(1))
|
||||
rm = if exist $(subst /,\,$(1)) del /q /s $(subst /,\,$(1))
|
||||
else
|
||||
mkdir = mkdir -p $(1)
|
||||
rm = rm -rf $(1)
|
||||
endif
|
||||
|
||||
CPPDEFINES := $(shell echo foo | $(CC) -dM -E -)
|
||||
|
||||
# construct build directory if BUILDDIR is not set.
|
||||
BUILDDIR ?= $(TARGET_DIR)build
|
||||
TARGETPLATFORM ?= $(shell uname)
|
||||
|
||||
CFLAGS += -D__PCTOOL__
|
||||
ifdef RBARCH
|
||||
|
@ -34,20 +43,20 @@ OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(SOURCES)))
|
|||
all: $(OUTPUT).a
|
||||
|
||||
$(OBJDIR)%.o: %.c
|
||||
@echo CC $<
|
||||
$(SILENT)mkdir -p $(dir $@)
|
||||
$(info CC $<)
|
||||
$(SILENT)$(call mkdir,$(dir $@))
|
||||
$(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
ifeq ($(findstring Darwin,$(TARGETPLATFORM)),Darwin)
|
||||
# some trickery to build ppc and i386 from a single call
|
||||
$(OUTPUT).a: $(TARGET_DIR)$(OUTPUT)i386.a $(TARGET_DIR)$(OUTPUT)ppc.a
|
||||
@echo lipo $(TARGET_DIR)$@
|
||||
$(SILENT) rm -f $(TARGET_DIR)$(OUTPUT)
|
||||
$(info lipo $(TARGET_DIR)$@)
|
||||
$(SILENT)$(call rm,$(TARGET_DIR)$(OUTPUT))
|
||||
$(SILENT)lipo -create $(TARGET_DIR)$(OUTPUT)ppc.a $(TARGET_DIR)$(OUTPUT)i386.a -output $(TARGET_DIR)$(OUTPUT).a
|
||||
|
||||
ifneq ($(RBARCH),)
|
||||
$(OUTPUT)$(RBARCH).a: $(OBJS)
|
||||
@echo AR $@
|
||||
$(info AR $@)
|
||||
$(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^
|
||||
else
|
||||
$(TARGET_DIR)$(OUTPUT)i386.a:
|
||||
|
@ -58,12 +67,10 @@ $(TARGET_DIR)$(OUTPUT)ppc.a:
|
|||
endif
|
||||
else
|
||||
$(OUTPUT).a: $(OBJS)
|
||||
@echo AR $@
|
||||
$(info AR $@)
|
||||
$(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^
|
||||
endif
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) $(OUTPUT) $(TARGET_DIR)$(OUTPUT)*.a
|
||||
ifeq ($(findstring Darwin,$(shell uname)),Darwin)
|
||||
endif
|
||||
$(call rm,$(OBJS) $(OUTPUT) $(TARGET_DIR)$(OUTPUT)*.a)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue