mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -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
|
OUTPUT=libskin_parser
|
||||||
TARGET_DIR ?= ./
|
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.
|
# construct build directory if BUILDDIR is not set.
|
||||||
BUILDDIR ?= $(TARGET_DIR)build
|
BUILDDIR ?= $(TARGET_DIR)build
|
||||||
TARGETPLATFORM ?= $(shell uname)
|
|
||||||
|
|
||||||
CFLAGS += -D__PCTOOL__
|
CFLAGS += -D__PCTOOL__
|
||||||
ifdef RBARCH
|
ifdef RBARCH
|
||||||
|
@ -34,20 +43,20 @@ OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(SOURCES)))
|
||||||
all: $(OUTPUT).a
|
all: $(OUTPUT).a
|
||||||
|
|
||||||
$(OBJDIR)%.o: %.c
|
$(OBJDIR)%.o: %.c
|
||||||
@echo CC $<
|
$(info CC $<)
|
||||||
$(SILENT)mkdir -p $(dir $@)
|
$(SILENT)$(call mkdir,$(dir $@))
|
||||||
$(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
|
$(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
ifeq ($(findstring Darwin,$(TARGETPLATFORM)),Darwin)
|
ifeq ($(findstring Darwin,$(TARGETPLATFORM)),Darwin)
|
||||||
# some trickery to build ppc and i386 from a single call
|
# some trickery to build ppc and i386 from a single call
|
||||||
$(OUTPUT).a: $(TARGET_DIR)$(OUTPUT)i386.a $(TARGET_DIR)$(OUTPUT)ppc.a
|
$(OUTPUT).a: $(TARGET_DIR)$(OUTPUT)i386.a $(TARGET_DIR)$(OUTPUT)ppc.a
|
||||||
@echo lipo $(TARGET_DIR)$@
|
$(info lipo $(TARGET_DIR)$@)
|
||||||
$(SILENT) rm -f $(TARGET_DIR)$(OUTPUT)
|
$(SILENT)$(call rm,$(TARGET_DIR)$(OUTPUT))
|
||||||
$(SILENT)lipo -create $(TARGET_DIR)$(OUTPUT)ppc.a $(TARGET_DIR)$(OUTPUT)i386.a -output $(TARGET_DIR)$(OUTPUT).a
|
$(SILENT)lipo -create $(TARGET_DIR)$(OUTPUT)ppc.a $(TARGET_DIR)$(OUTPUT)i386.a -output $(TARGET_DIR)$(OUTPUT).a
|
||||||
|
|
||||||
ifneq ($(RBARCH),)
|
ifneq ($(RBARCH),)
|
||||||
$(OUTPUT)$(RBARCH).a: $(OBJS)
|
$(OUTPUT)$(RBARCH).a: $(OBJS)
|
||||||
@echo AR $@
|
$(info AR $@)
|
||||||
$(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^
|
$(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^
|
||||||
else
|
else
|
||||||
$(TARGET_DIR)$(OUTPUT)i386.a:
|
$(TARGET_DIR)$(OUTPUT)i386.a:
|
||||||
|
@ -58,12 +67,10 @@ $(TARGET_DIR)$(OUTPUT)ppc.a:
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
$(OUTPUT).a: $(OBJS)
|
$(OUTPUT).a: $(OBJS)
|
||||||
@echo AR $@
|
$(info AR $@)
|
||||||
$(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^
|
$(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^
|
||||||
endif
|
endif
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJS) $(OUTPUT) $(TARGET_DIR)$(OUTPUT)*.a
|
$(call rm,$(OBJS) $(OUTPUT) $(TARGET_DIR)$(OUTPUT)*.a)
|
||||||
ifeq ($(findstring Darwin,$(shell uname)),Darwin)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue