-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
70 lines (48 loc) · 1.58 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
.SUFFIXES:
ifeq ($(strip $(PSL1GHT)),)
$(error "PSL1GHT must be set in the environment.")
endif
include $(PSL1GHT)/ppu_rules
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCE := source
INCLUDE := source
DATA := data
LIBS :=
LUA_HEADERS := ./source/lauxlib.h ./source/lua.h ./source/lua.hpp ./source/luaconf.h ./source/lualib.h
LD := ppu-ld
ifneq ($(BUILD),$(notdir $(CURDIR)))
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCE),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export BUILDDIR := $(CURDIR)/$(BUILD)
export DEPSDIR := $(BUILDDIR)
CFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.c)))
CXXFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.S)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.bin)))
export OFILES := $(CFILES:.c=.o) \
$(CXXFILES:.cpp=.o) \
$(SFILES:.S=.o)
export BINFILES := $(BINFILES:.bin=.bin.h)
export INCLUDES := $(foreach dir,$(INCLUDE),-I$(CURDIR)/$(dir)) \
-I$(CURDIR)/$(BUILD) \
-I$(PORTLIBS)/include/ \
-I$(PSL1GHT)/ppu/include
CFLAGS := -g -O2 -Wall --std=gnu99 $(INCLUDES)
.PHONY: $(BUILD) clean
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
clean:
@echo Clean...
@rm -rf $(BUILD) $(OUTPUT).elf $(OUTPUT).self $(OUTPUT).a
install:
@echo Install...
@cp $(OUTPUT).a $(PORTLIBS)/lib
@cp $(LUA_HEADERS) $(PORTLIBS)/include
else
DEPENDS := $(OFILES:.o=.d)
$(OUTPUT).a: $(OFILES)
-include $(DEPENDS)
endif