diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-09-04 19:10:15 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-09-04 19:13:54 +0200 |
commit | 5f5e44f593f3c33beb813e8ae2948bc96d49681d (patch) | |
tree | f7705d652b81ce552c300b1cbdf59018305bb552 | |
parent | db350ac3e2064ba09d81173abea589f70fe1a106 (diff) | |
download | rockbox-5f5e44f593f3c33beb813e8ae2948bc96d49681d.tar.gz rockbox-5f5e44f593f3c33beb813e8ae2948bc96d49681d.zip |
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
-rw-r--r-- | lib/skin_parser/Makefile | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/skin_parser/Makefile b/lib/skin_parser/Makefile index 08b7fa14d3..c4dd57dcac 100644 --- a/lib/skin_parser/Makefile +++ b/lib/skin_parser/Makefile | |||
@@ -15,9 +15,18 @@ AR ?= ar | |||
15 | OUTPUT=libskin_parser | 15 | OUTPUT=libskin_parser |
16 | TARGET_DIR ?= ./ | 16 | TARGET_DIR ?= ./ |
17 | 17 | ||
18 | ifeq ($(OS),Windows_NT) | ||
19 | mkdir = if not exist $(subst /,\,$(1)) mkdir $(subst /,\,$(1)) | ||
20 | rm = if exist $(subst /,\,$(1)) del /q /s $(subst /,\,$(1)) | ||
21 | else | ||
22 | mkdir = mkdir -p $(1) | ||
23 | rm = rm -rf $(1) | ||
24 | endif | ||
25 | |||
26 | CPPDEFINES := $(shell echo foo | $(CC) -dM -E -) | ||
27 | |||
18 | # construct build directory if BUILDDIR is not set. | 28 | # construct build directory if BUILDDIR is not set. |
19 | BUILDDIR ?= $(TARGET_DIR)build | 29 | BUILDDIR ?= $(TARGET_DIR)build |
20 | TARGETPLATFORM ?= $(shell uname) | ||
21 | 30 | ||
22 | CFLAGS += -D__PCTOOL__ | 31 | CFLAGS += -D__PCTOOL__ |
23 | ifdef RBARCH | 32 | ifdef RBARCH |
@@ -34,20 +43,20 @@ OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(SOURCES))) | |||
34 | all: $(OUTPUT).a | 43 | all: $(OUTPUT).a |
35 | 44 | ||
36 | $(OBJDIR)%.o: %.c | 45 | $(OBJDIR)%.o: %.c |
37 | @echo CC $< | 46 | $(info CC $<) |
38 | $(SILENT)mkdir -p $(dir $@) | 47 | $(SILENT)$(call mkdir,$(dir $@)) |
39 | $(SILENT)$(CC) $(CFLAGS) -c -o $@ $< | 48 | $(SILENT)$(CC) $(CFLAGS) -c -o $@ $< |
40 | 49 | ||
41 | ifeq ($(findstring Darwin,$(TARGETPLATFORM)),Darwin) | 50 | ifeq ($(findstring Darwin,$(TARGETPLATFORM)),Darwin) |
42 | # some trickery to build ppc and i386 from a single call | 51 | # some trickery to build ppc and i386 from a single call |
43 | $(OUTPUT).a: $(TARGET_DIR)$(OUTPUT)i386.a $(TARGET_DIR)$(OUTPUT)ppc.a | 52 | $(OUTPUT).a: $(TARGET_DIR)$(OUTPUT)i386.a $(TARGET_DIR)$(OUTPUT)ppc.a |
44 | @echo lipo $(TARGET_DIR)$@ | 53 | $(info lipo $(TARGET_DIR)$@) |
45 | $(SILENT) rm -f $(TARGET_DIR)$(OUTPUT) | 54 | $(SILENT)$(call rm,$(TARGET_DIR)$(OUTPUT)) |
46 | $(SILENT)lipo -create $(TARGET_DIR)$(OUTPUT)ppc.a $(TARGET_DIR)$(OUTPUT)i386.a -output $(TARGET_DIR)$(OUTPUT).a | 55 | $(SILENT)lipo -create $(TARGET_DIR)$(OUTPUT)ppc.a $(TARGET_DIR)$(OUTPUT)i386.a -output $(TARGET_DIR)$(OUTPUT).a |
47 | 56 | ||
48 | ifneq ($(RBARCH),) | 57 | ifneq ($(RBARCH),) |
49 | $(OUTPUT)$(RBARCH).a: $(OBJS) | 58 | $(OUTPUT)$(RBARCH).a: $(OBJS) |
50 | @echo AR $@ | 59 | $(info AR $@) |
51 | $(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^ | 60 | $(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^ |
52 | else | 61 | else |
53 | $(TARGET_DIR)$(OUTPUT)i386.a: | 62 | $(TARGET_DIR)$(OUTPUT)i386.a: |
@@ -58,12 +67,10 @@ $(TARGET_DIR)$(OUTPUT)ppc.a: | |||
58 | endif | 67 | endif |
59 | else | 68 | else |
60 | $(OUTPUT).a: $(OBJS) | 69 | $(OUTPUT).a: $(OBJS) |
61 | @echo AR $@ | 70 | $(info AR $@) |
62 | $(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^ | 71 | $(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^ |
63 | endif | 72 | endif |
64 | 73 | ||
65 | clean: | 74 | clean: |
66 | rm -f $(OBJS) $(OUTPUT) $(TARGET_DIR)$(OUTPUT)*.a | 75 | $(call rm,$(OBJS) $(OUTPUT) $(TARGET_DIR)$(OUTPUT)*.a) |
67 | ifeq ($(findstring Darwin,$(shell uname)),Darwin) | ||
68 | endif | ||
69 | 76 | ||