From d949dc8bd15d3eab2b43772cff5d369f449dcecc Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 10 Mar 2018 13:26:43 +0100 Subject: [PATCH] [Makefile] Split up the plugin makefiles, now common changes can be done in makefile.mk --- Makefile | 1 + ide_templates/codeblocks/Makefile | 60 ++++++++++-------------- ide_templates/codeblocks/makefile.mk | 47 +++++++++++++++++++ plugin_makefile.mk | 16 +++++++ plugins/example_plugin/Makefile | 61 +++++++++++------------- plugins/example_plugin/makefile.mk | 47 +++++++++++++++++++ plugins/hid_to_vpad/Makefile | 63 +++++++++++-------------- plugins/hid_to_vpad/makefile.mk | 47 +++++++++++++++++++ plugins/memory_info/Makefile | 61 +++++++++++------------- plugins/memory_info/makefile.mk | 47 +++++++++++++++++++ plugins/nnu_patcher/Makefile | 61 +++++++++++------------- plugins/nnu_patcher/makefile.mk | 47 +++++++++++++++++++ plugins/overlay/Makefile | 63 +++++++++++-------------- plugins/overlay/makefile.mk | 47 +++++++++++++++++++ plugins/padcon/Makefile | 61 +++++++++++------------- plugins/padcon/makefile.mk | 47 +++++++++++++++++++ plugins/screenshot/Makefile | 61 +++++++++++------------- plugins/screenshot/makefile.mk | 47 +++++++++++++++++++ plugins/sdcafiine/Makefile | 69 +++++++++++----------------- plugins/sdcafiine/makefile.mk | 50 ++++++++++++++++++++ plugins/sdcafiine/src/patches.cpp | 2 +- plugins/swipswapme/Makefile | 63 +++++++++++-------------- plugins/swipswapme/makefile.mk | 49 ++++++++++++++++++++ 23 files changed, 754 insertions(+), 363 deletions(-) create mode 100644 ide_templates/codeblocks/makefile.mk create mode 100644 plugin_makefile.mk create mode 100644 plugins/example_plugin/makefile.mk create mode 100644 plugins/hid_to_vpad/makefile.mk create mode 100644 plugins/memory_info/makefile.mk create mode 100644 plugins/nnu_patcher/makefile.mk create mode 100644 plugins/overlay/makefile.mk create mode 100644 plugins/padcon/makefile.mk create mode 100644 plugins/screenshot/makefile.mk create mode 100644 plugins/sdcafiine/makefile.mk create mode 100644 plugins/swipswapme/makefile.mk diff --git a/Makefile b/Makefile index b096196..7ef7427 100644 --- a/Makefile +++ b/Makefile @@ -107,6 +107,7 @@ install : wups.ld wups_elf.ld $Qcp -r wups_include $(WUPSDIR)/include $Qcp -r wups.ld $(WUPSDIR) $Qcp -r wups_elf.ld $(WUPSDIR) + $Qcp -r plugin_makefile.mk $(WUPSDIR) @cp $(BUILD)/lib/libwups.a $(WUPSDIR)/lib/ #--------------------------------------------------------------------------------- diff --git a/ide_templates/codeblocks/Makefile b/ide_templates/codeblocks/Makefile index d28c1d1..e70eef7 100644 --- a/ide_templates/codeblocks/Makefile +++ b/ide_templates/codeblocks/Makefile @@ -1,4 +1,4 @@ -DO_LOGGING := 1 + #--------------------------------------------------------------------------------- # Clear the implicit built in rules @@ -33,13 +33,16 @@ export OBJCOPY := $(PREFIX)objcopy #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)).mod BUILD := build -SOURCES := src -DATA := +ifeq ($(notdir $(CURDIR)),$(BUILD)) +include ../makefile.mk +else +include makefile.mk +endif -INCLUDES := src +include $(WUPSDIR)/plugin_makefile.mk -MAP ?= $(TARGET:.mod=.map) +#MAP ?= $(TARGET:.mod=.map) #--------------------------------------------------------------------------------- # options for code generation @@ -75,21 +78,11 @@ ifeq ($(DO_LOGGING), 1) CXXFLAGS += -D__LOGGING__ endif -ASFLAGS := -mregnames -# --relocatable: make sure ld doesn't remove relocations wups will need -# -s: strip local symbols to speed linking -# -u: keep certain sections -# -wrap: wrap function -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain wups sections together) -# -Map: generate a map file +ASFLAGS += -LDFLAG_COMMON += -u wups_load -u wups_meta -u wups_hooks -T $(WUPSDIR)/wups.ld \ - -Wl,-wrap,open,-wrap,close,-wrap,write,-wrap,read,-wrap,lseek,-wrap,stat,-wrap,fstat,-wrap,opendir,-wrap,closedir,-wrap,readdir,-wrap,mkdir \ - -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,--gc-sections - -LDFLAGS_MOD += $(LDFLAG_COMMON),--relocatable -LDFLAGS_ELF += --relocatable -s -T $(WUPSDIR)/wups_elf.ld +LDFLAG_COMMON += +LDFLAGS_MOD += +LDFLAGS_ELF += #--------------------------------------------------------------------------------- Q := @ @@ -97,14 +90,14 @@ MAKEFLAGS += --no-print-directory #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lwups -lutils -ldynamiclibs +ALL_LIBS := $(LIBS) # #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- -LIBDIRS := $(DEVKITPPC) +LIBDIRS += #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional @@ -145,17 +138,16 @@ export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ +export INCLUDE_FULL += $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include \ - -I$(PORTLIBS)/include/libutils -I$(WUPSDIR)/include + $(EXTERNAL_INCLUDE) #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(PORTLIBS)/lib \ - -L$(WUPSDIR)/lib +export LIBPATHS_FULL += $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ + $(EXTERNAL_LIBPATHS) + export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean install @@ -188,16 +180,14 @@ all : $(OUTPUT) # Rule to make the module file. $(OUTPUT) : output.elf @echo "checking for missing symbols ..." - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(LIBS) $(LIBPATHS) -o check_linking.elf + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(ALL_LIBS) $(LIBPATHS_FULL) -o check_linking.elf @echo "linking ..." $@ - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(LIBS) $(LIBPATHS) -o $@ + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ # Rule to make the module file. output.elf : $(OFILES) @echo "linking ... output.elf" - - - @$(LD) $(OFILES) $(LDFLAGS_ELF) $(LIBS) $(LIBPATHS) -o $@ + @$(LD) $(OFILES) $(LDFLAGS_ELF) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ ############################################################################### # Standard build rules @@ -211,17 +201,17 @@ output.elf : $(OFILES) #--------------------------------------------------------------------------------- %.o: %.cpp @echo $(notdir $<) - @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.c @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + $(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.S @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.png.o : %.png diff --git a/ide_templates/codeblocks/makefile.mk b/ide_templates/codeblocks/makefile.mk new file mode 100644 index 0000000..a352000 --- /dev/null +++ b/ide_templates/codeblocks/makefile.mk @@ -0,0 +1,47 @@ +# Compiling the projects with libutils logging code? +DO_LOGGING := 1 + +# Target filename +TARGET := $(notdir $(CURDIR)).mod + +# Source directories +SOURCES := src + +# Data directories +DATA := + +# Include directories +INCLUDES := src + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +# Extra C compiler flags +CFLAGS := +# Extra C++ compiler flags +CXXFLAGS := + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(WUPSDIR) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lwups -lutils -ldynamiclibs + +#--------------------------------------------------------------------------------- +# Will be added to the final lib paths +# example: +# -L$C:/library1/lib +#--------------------------------------------------------------------------------- +EXTERNAL_LIBPATHS := + +#--------------------------------------------------------------------------------- +# Will be added to the final include paths +# -IC:/library1/include +#--------------------------------------------------------------------------------- +EXTERNAL_INCLUDE := -I$(PORTLIBS)/include/libutils \ + -I$(WUPSDIR)/include diff --git a/plugin_makefile.mk b/plugin_makefile.mk new file mode 100644 index 0000000..de2ae3f --- /dev/null +++ b/plugin_makefile.mk @@ -0,0 +1,16 @@ +ASFLAGS := -mregnames + +# --relocatable: make sure ld doesn't remove relocations wups will need +# -s: strip local symbols to speed linking +# -u: keep certain sections +# -wrap: wrap function +# --gc-sections: remove unneeded symbols +# -T: use the linker script specified (to force certain wups sections together) +# -Map: generate a map file + +LDFLAG_COMMON := -u wups_load -u wups_meta -u wups_hooks -T $(WUPSDIR)/wups.ld \ + -Wl,-wrap,open,-wrap,close,-wrap,write,-wrap,read,-wrap,lseek,-wrap,stat,-wrap,fstat,-wrap,opendir,-wrap,closedir,-wrap,readdir,-wrap,mkdir \ + -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,--gc-sections + +LDFLAGS_MOD := $(LDFLAG_COMMON),--relocatable +LDFLAGS_ELF := --relocatable -s -T $(WUPSDIR)/wups_elf.ld \ No newline at end of file diff --git a/plugins/example_plugin/Makefile b/plugins/example_plugin/Makefile index d28c1d1..67f1bad 100644 --- a/plugins/example_plugin/Makefile +++ b/plugins/example_plugin/Makefile @@ -1,4 +1,5 @@ -DO_LOGGING := 1 +# You probably never need to adjust this Makefile. +# All changes can be done in the makefile.mk #--------------------------------------------------------------------------------- # Clear the implicit built in rules @@ -33,13 +34,16 @@ export OBJCOPY := $(PREFIX)objcopy #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)).mod BUILD := build -SOURCES := src -DATA := +ifeq ($(notdir $(CURDIR)),$(BUILD)) +include ../makefile.mk +else +include makefile.mk +endif -INCLUDES := src +include $(WUPSDIR)/plugin_makefile.mk -MAP ?= $(TARGET:.mod=.map) +#MAP ?= $(TARGET:.mod=.map) #--------------------------------------------------------------------------------- # options for code generation @@ -75,21 +79,11 @@ ifeq ($(DO_LOGGING), 1) CXXFLAGS += -D__LOGGING__ endif -ASFLAGS := -mregnames -# --relocatable: make sure ld doesn't remove relocations wups will need -# -s: strip local symbols to speed linking -# -u: keep certain sections -# -wrap: wrap function -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain wups sections together) -# -Map: generate a map file +ASFLAGS += -LDFLAG_COMMON += -u wups_load -u wups_meta -u wups_hooks -T $(WUPSDIR)/wups.ld \ - -Wl,-wrap,open,-wrap,close,-wrap,write,-wrap,read,-wrap,lseek,-wrap,stat,-wrap,fstat,-wrap,opendir,-wrap,closedir,-wrap,readdir,-wrap,mkdir \ - -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,--gc-sections - -LDFLAGS_MOD += $(LDFLAG_COMMON),--relocatable -LDFLAGS_ELF += --relocatable -s -T $(WUPSDIR)/wups_elf.ld +LDFLAG_COMMON += +LDFLAGS_MOD += +LDFLAGS_ELF += #--------------------------------------------------------------------------------- Q := @ @@ -97,14 +91,14 @@ MAKEFLAGS += --no-print-directory #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lwups -lutils -ldynamiclibs +ALL_LIBS := $(LIBS) # #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- -LIBDIRS := $(DEVKITPPC) +LIBDIRS += #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional @@ -145,17 +139,16 @@ export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ +export INCLUDE_FULL += $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include \ - -I$(PORTLIBS)/include/libutils -I$(WUPSDIR)/include + $(EXTERNAL_INCLUDE) #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(PORTLIBS)/lib \ - -L$(WUPSDIR)/lib +export LIBPATHS_FULL += $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ + $(EXTERNAL_LIBPATHS) + export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean install @@ -188,16 +181,14 @@ all : $(OUTPUT) # Rule to make the module file. $(OUTPUT) : output.elf @echo "checking for missing symbols ..." - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(LIBS) $(LIBPATHS) -o check_linking.elf + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(ALL_LIBS) $(LIBPATHS_FULL) -o check_linking.elf @echo "linking ..." $@ - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(LIBS) $(LIBPATHS) -o $@ + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ # Rule to make the module file. output.elf : $(OFILES) @echo "linking ... output.elf" - - - @$(LD) $(OFILES) $(LDFLAGS_ELF) $(LIBS) $(LIBPATHS) -o $@ + @$(LD) $(OFILES) $(LDFLAGS_ELF) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ ############################################################################### # Standard build rules @@ -211,17 +202,17 @@ output.elf : $(OFILES) #--------------------------------------------------------------------------------- %.o: %.cpp @echo $(notdir $<) - @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.c @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.S @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.png.o : %.png diff --git a/plugins/example_plugin/makefile.mk b/plugins/example_plugin/makefile.mk new file mode 100644 index 0000000..a352000 --- /dev/null +++ b/plugins/example_plugin/makefile.mk @@ -0,0 +1,47 @@ +# Compiling the projects with libutils logging code? +DO_LOGGING := 1 + +# Target filename +TARGET := $(notdir $(CURDIR)).mod + +# Source directories +SOURCES := src + +# Data directories +DATA := + +# Include directories +INCLUDES := src + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +# Extra C compiler flags +CFLAGS := +# Extra C++ compiler flags +CXXFLAGS := + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(WUPSDIR) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lwups -lutils -ldynamiclibs + +#--------------------------------------------------------------------------------- +# Will be added to the final lib paths +# example: +# -L$C:/library1/lib +#--------------------------------------------------------------------------------- +EXTERNAL_LIBPATHS := + +#--------------------------------------------------------------------------------- +# Will be added to the final include paths +# -IC:/library1/include +#--------------------------------------------------------------------------------- +EXTERNAL_INCLUDE := -I$(PORTLIBS)/include/libutils \ + -I$(WUPSDIR)/include diff --git a/plugins/hid_to_vpad/Makefile b/plugins/hid_to_vpad/Makefile index fde1f49..67f1bad 100644 --- a/plugins/hid_to_vpad/Makefile +++ b/plugins/hid_to_vpad/Makefile @@ -1,4 +1,5 @@ -DO_LOGGING := 1 +# You probably never need to adjust this Makefile. +# All changes can be done in the makefile.mk #--------------------------------------------------------------------------------- # Clear the implicit built in rules @@ -33,15 +34,16 @@ export OBJCOPY := $(PREFIX)objcopy #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)).mod BUILD := build -SOURCES := src \ - src/common \ - src/utils -DATA := +ifeq ($(notdir $(CURDIR)),$(BUILD)) +include ../makefile.mk +else +include makefile.mk +endif -INCLUDES := src +include $(WUPSDIR)/plugin_makefile.mk -MAP ?= $(TARGET:.mod=.map) +#MAP ?= $(TARGET:.mod=.map) #--------------------------------------------------------------------------------- # options for code generation @@ -77,21 +79,11 @@ ifeq ($(DO_LOGGING), 1) CXXFLAGS += -D__LOGGING__ endif -ASFLAGS := -mregnames -# --relocatable: make sure ld doesn't remove relocations wups will need -# -s: strip local symbols to speed linking -# -u: keep certain sections -# -wrap: wrap function -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain wups sections together) -# -Map: generate a map file +ASFLAGS += -LDFLAG_COMMON += -u wups_load -u wups_meta -u wups_hooks -T $(WUPSDIR)/wups.ld \ - -Wl,-wrap,open,-wrap,close,-wrap,write,-wrap,read,-wrap,lseek,-wrap,stat,-wrap,fstat,-wrap,opendir,-wrap,closedir,-wrap,readdir,-wrap,mkdir \ - -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,--gc-sections - -LDFLAGS_MOD += $(LDFLAG_COMMON),--relocatable -LDFLAGS_ELF += --relocatable -s -T $(WUPSDIR)/wups_elf.ld +LDFLAG_COMMON += +LDFLAGS_MOD += +LDFLAGS_ELF += #--------------------------------------------------------------------------------- Q := @ @@ -99,14 +91,14 @@ MAKEFLAGS += --no-print-directory #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lwups -lcontrollerpatcher -lutils -ldynamiclibs +ALL_LIBS := $(LIBS) # #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- -LIBDIRS := $(DEVKITPPC) +LIBDIRS += #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional @@ -147,17 +139,16 @@ export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ +export INCLUDE_FULL += $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include \ - -I$(PORTLIBS)/include/libutils -I$(WUPSDIR)/include + $(EXTERNAL_INCLUDE) #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(PORTLIBS)/lib \ - -L$(WUPSDIR)/lib +export LIBPATHS_FULL += $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ + $(EXTERNAL_LIBPATHS) + export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean install @@ -190,16 +181,14 @@ all : $(OUTPUT) # Rule to make the module file. $(OUTPUT) : output.elf @echo "checking for missing symbols ..." - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(LIBS) $(LIBPATHS) -o check_linking.elf + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(ALL_LIBS) $(LIBPATHS_FULL) -o check_linking.elf @echo "linking ..." $@ - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(LIBS) $(LIBPATHS) -o $@ + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ # Rule to make the module file. output.elf : $(OFILES) @echo "linking ... output.elf" - - - @$(LD) $(OFILES) $(LDFLAGS_ELF) $(LIBS) $(LIBPATHS) -o $@ + @$(LD) $(OFILES) $(LDFLAGS_ELF) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ ############################################################################### # Standard build rules @@ -213,17 +202,17 @@ output.elf : $(OFILES) #--------------------------------------------------------------------------------- %.o: %.cpp @echo $(notdir $<) - @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.c @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.S @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.png.o : %.png diff --git a/plugins/hid_to_vpad/makefile.mk b/plugins/hid_to_vpad/makefile.mk new file mode 100644 index 0000000..461fffc --- /dev/null +++ b/plugins/hid_to_vpad/makefile.mk @@ -0,0 +1,47 @@ +# Compiling the projects with libutils logging code? +DO_LOGGING := 1 + +# Target filename +TARGET := $(notdir $(CURDIR)).mod + +# Source directories +SOURCES := src + +# Data directories +DATA := + +# Include directories +INCLUDES := src + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +# Extra C compiler flags +CFLAGS := +# Extra C++ compiler flags +CXXFLAGS := + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(WUPSDIR) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lwups -lcontrollerpatcher -lutils -ldynamiclibs + +#--------------------------------------------------------------------------------- +# Will be added to the final lib paths +# example: +# -L$C:/library1/lib +#--------------------------------------------------------------------------------- +EXTERNAL_LIBPATHS := + +#--------------------------------------------------------------------------------- +# Will be added to the final include paths +# -IC:/library1/include +#--------------------------------------------------------------------------------- +EXTERNAL_INCLUDE := -I$(PORTLIBS)/include/libutils \ + -I$(WUPSDIR)/include diff --git a/plugins/memory_info/Makefile b/plugins/memory_info/Makefile index d28c1d1..67f1bad 100644 --- a/plugins/memory_info/Makefile +++ b/plugins/memory_info/Makefile @@ -1,4 +1,5 @@ -DO_LOGGING := 1 +# You probably never need to adjust this Makefile. +# All changes can be done in the makefile.mk #--------------------------------------------------------------------------------- # Clear the implicit built in rules @@ -33,13 +34,16 @@ export OBJCOPY := $(PREFIX)objcopy #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)).mod BUILD := build -SOURCES := src -DATA := +ifeq ($(notdir $(CURDIR)),$(BUILD)) +include ../makefile.mk +else +include makefile.mk +endif -INCLUDES := src +include $(WUPSDIR)/plugin_makefile.mk -MAP ?= $(TARGET:.mod=.map) +#MAP ?= $(TARGET:.mod=.map) #--------------------------------------------------------------------------------- # options for code generation @@ -75,21 +79,11 @@ ifeq ($(DO_LOGGING), 1) CXXFLAGS += -D__LOGGING__ endif -ASFLAGS := -mregnames -# --relocatable: make sure ld doesn't remove relocations wups will need -# -s: strip local symbols to speed linking -# -u: keep certain sections -# -wrap: wrap function -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain wups sections together) -# -Map: generate a map file +ASFLAGS += -LDFLAG_COMMON += -u wups_load -u wups_meta -u wups_hooks -T $(WUPSDIR)/wups.ld \ - -Wl,-wrap,open,-wrap,close,-wrap,write,-wrap,read,-wrap,lseek,-wrap,stat,-wrap,fstat,-wrap,opendir,-wrap,closedir,-wrap,readdir,-wrap,mkdir \ - -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,--gc-sections - -LDFLAGS_MOD += $(LDFLAG_COMMON),--relocatable -LDFLAGS_ELF += --relocatable -s -T $(WUPSDIR)/wups_elf.ld +LDFLAG_COMMON += +LDFLAGS_MOD += +LDFLAGS_ELF += #--------------------------------------------------------------------------------- Q := @ @@ -97,14 +91,14 @@ MAKEFLAGS += --no-print-directory #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lwups -lutils -ldynamiclibs +ALL_LIBS := $(LIBS) # #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- -LIBDIRS := $(DEVKITPPC) +LIBDIRS += #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional @@ -145,17 +139,16 @@ export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ +export INCLUDE_FULL += $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include \ - -I$(PORTLIBS)/include/libutils -I$(WUPSDIR)/include + $(EXTERNAL_INCLUDE) #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(PORTLIBS)/lib \ - -L$(WUPSDIR)/lib +export LIBPATHS_FULL += $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ + $(EXTERNAL_LIBPATHS) + export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean install @@ -188,16 +181,14 @@ all : $(OUTPUT) # Rule to make the module file. $(OUTPUT) : output.elf @echo "checking for missing symbols ..." - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(LIBS) $(LIBPATHS) -o check_linking.elf + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(ALL_LIBS) $(LIBPATHS_FULL) -o check_linking.elf @echo "linking ..." $@ - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(LIBS) $(LIBPATHS) -o $@ + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ # Rule to make the module file. output.elf : $(OFILES) @echo "linking ... output.elf" - - - @$(LD) $(OFILES) $(LDFLAGS_ELF) $(LIBS) $(LIBPATHS) -o $@ + @$(LD) $(OFILES) $(LDFLAGS_ELF) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ ############################################################################### # Standard build rules @@ -211,17 +202,17 @@ output.elf : $(OFILES) #--------------------------------------------------------------------------------- %.o: %.cpp @echo $(notdir $<) - @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.c @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.S @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.png.o : %.png diff --git a/plugins/memory_info/makefile.mk b/plugins/memory_info/makefile.mk new file mode 100644 index 0000000..a352000 --- /dev/null +++ b/plugins/memory_info/makefile.mk @@ -0,0 +1,47 @@ +# Compiling the projects with libutils logging code? +DO_LOGGING := 1 + +# Target filename +TARGET := $(notdir $(CURDIR)).mod + +# Source directories +SOURCES := src + +# Data directories +DATA := + +# Include directories +INCLUDES := src + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +# Extra C compiler flags +CFLAGS := +# Extra C++ compiler flags +CXXFLAGS := + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(WUPSDIR) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lwups -lutils -ldynamiclibs + +#--------------------------------------------------------------------------------- +# Will be added to the final lib paths +# example: +# -L$C:/library1/lib +#--------------------------------------------------------------------------------- +EXTERNAL_LIBPATHS := + +#--------------------------------------------------------------------------------- +# Will be added to the final include paths +# -IC:/library1/include +#--------------------------------------------------------------------------------- +EXTERNAL_INCLUDE := -I$(PORTLIBS)/include/libutils \ + -I$(WUPSDIR)/include diff --git a/plugins/nnu_patcher/Makefile b/plugins/nnu_patcher/Makefile index d28c1d1..67f1bad 100644 --- a/plugins/nnu_patcher/Makefile +++ b/plugins/nnu_patcher/Makefile @@ -1,4 +1,5 @@ -DO_LOGGING := 1 +# You probably never need to adjust this Makefile. +# All changes can be done in the makefile.mk #--------------------------------------------------------------------------------- # Clear the implicit built in rules @@ -33,13 +34,16 @@ export OBJCOPY := $(PREFIX)objcopy #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)).mod BUILD := build -SOURCES := src -DATA := +ifeq ($(notdir $(CURDIR)),$(BUILD)) +include ../makefile.mk +else +include makefile.mk +endif -INCLUDES := src +include $(WUPSDIR)/plugin_makefile.mk -MAP ?= $(TARGET:.mod=.map) +#MAP ?= $(TARGET:.mod=.map) #--------------------------------------------------------------------------------- # options for code generation @@ -75,21 +79,11 @@ ifeq ($(DO_LOGGING), 1) CXXFLAGS += -D__LOGGING__ endif -ASFLAGS := -mregnames -# --relocatable: make sure ld doesn't remove relocations wups will need -# -s: strip local symbols to speed linking -# -u: keep certain sections -# -wrap: wrap function -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain wups sections together) -# -Map: generate a map file +ASFLAGS += -LDFLAG_COMMON += -u wups_load -u wups_meta -u wups_hooks -T $(WUPSDIR)/wups.ld \ - -Wl,-wrap,open,-wrap,close,-wrap,write,-wrap,read,-wrap,lseek,-wrap,stat,-wrap,fstat,-wrap,opendir,-wrap,closedir,-wrap,readdir,-wrap,mkdir \ - -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,--gc-sections - -LDFLAGS_MOD += $(LDFLAG_COMMON),--relocatable -LDFLAGS_ELF += --relocatable -s -T $(WUPSDIR)/wups_elf.ld +LDFLAG_COMMON += +LDFLAGS_MOD += +LDFLAGS_ELF += #--------------------------------------------------------------------------------- Q := @ @@ -97,14 +91,14 @@ MAKEFLAGS += --no-print-directory #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lwups -lutils -ldynamiclibs +ALL_LIBS := $(LIBS) # #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- -LIBDIRS := $(DEVKITPPC) +LIBDIRS += #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional @@ -145,17 +139,16 @@ export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ +export INCLUDE_FULL += $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include \ - -I$(PORTLIBS)/include/libutils -I$(WUPSDIR)/include + $(EXTERNAL_INCLUDE) #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(PORTLIBS)/lib \ - -L$(WUPSDIR)/lib +export LIBPATHS_FULL += $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ + $(EXTERNAL_LIBPATHS) + export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean install @@ -188,16 +181,14 @@ all : $(OUTPUT) # Rule to make the module file. $(OUTPUT) : output.elf @echo "checking for missing symbols ..." - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(LIBS) $(LIBPATHS) -o check_linking.elf + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(ALL_LIBS) $(LIBPATHS_FULL) -o check_linking.elf @echo "linking ..." $@ - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(LIBS) $(LIBPATHS) -o $@ + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ # Rule to make the module file. output.elf : $(OFILES) @echo "linking ... output.elf" - - - @$(LD) $(OFILES) $(LDFLAGS_ELF) $(LIBS) $(LIBPATHS) -o $@ + @$(LD) $(OFILES) $(LDFLAGS_ELF) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ ############################################################################### # Standard build rules @@ -211,17 +202,17 @@ output.elf : $(OFILES) #--------------------------------------------------------------------------------- %.o: %.cpp @echo $(notdir $<) - @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.c @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.S @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.png.o : %.png diff --git a/plugins/nnu_patcher/makefile.mk b/plugins/nnu_patcher/makefile.mk new file mode 100644 index 0000000..a352000 --- /dev/null +++ b/plugins/nnu_patcher/makefile.mk @@ -0,0 +1,47 @@ +# Compiling the projects with libutils logging code? +DO_LOGGING := 1 + +# Target filename +TARGET := $(notdir $(CURDIR)).mod + +# Source directories +SOURCES := src + +# Data directories +DATA := + +# Include directories +INCLUDES := src + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +# Extra C compiler flags +CFLAGS := +# Extra C++ compiler flags +CXXFLAGS := + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(WUPSDIR) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lwups -lutils -ldynamiclibs + +#--------------------------------------------------------------------------------- +# Will be added to the final lib paths +# example: +# -L$C:/library1/lib +#--------------------------------------------------------------------------------- +EXTERNAL_LIBPATHS := + +#--------------------------------------------------------------------------------- +# Will be added to the final include paths +# -IC:/library1/include +#--------------------------------------------------------------------------------- +EXTERNAL_INCLUDE := -I$(PORTLIBS)/include/libutils \ + -I$(WUPSDIR)/include diff --git a/plugins/overlay/Makefile b/plugins/overlay/Makefile index dc104eb..67f1bad 100644 --- a/plugins/overlay/Makefile +++ b/plugins/overlay/Makefile @@ -1,4 +1,5 @@ -DO_LOGGING := 1 +# You probably never need to adjust this Makefile. +# All changes can be done in the makefile.mk #--------------------------------------------------------------------------------- # Clear the implicit built in rules @@ -33,15 +34,16 @@ export OBJCOPY := $(PREFIX)objcopy #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)).mod BUILD := build -SOURCES := src \ - src/common \ - src/utils -DATA := +ifeq ($(notdir $(CURDIR)),$(BUILD)) +include ../makefile.mk +else +include makefile.mk +endif -INCLUDES := src +include $(WUPSDIR)/plugin_makefile.mk -MAP ?= $(TARGET:.mod=.map) +#MAP ?= $(TARGET:.mod=.map) #--------------------------------------------------------------------------------- # options for code generation @@ -77,21 +79,11 @@ ifeq ($(DO_LOGGING), 1) CXXFLAGS += -D__LOGGING__ endif -ASFLAGS := -mregnames -# --relocatable: make sure ld doesn't remove relocations wups will need -# -s: strip local symbols to speed linking -# -u: keep certain sections -# -wrap: wrap function -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain wups sections together) -# -Map: generate a map file +ASFLAGS += -LDFLAG_COMMON += -u wups_load -u wups_meta -u wups_hooks -T $(WUPSDIR)/wups.ld \ - -Wl,-wrap,open,-wrap,close,-wrap,write,-wrap,read,-wrap,lseek,-wrap,stat,-wrap,fstat,-wrap,opendir,-wrap,closedir,-wrap,readdir,-wrap,mkdir \ - -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,--gc-sections - -LDFLAGS_MOD += $(LDFLAG_COMMON),--relocatable -LDFLAGS_ELF += --relocatable -s -T $(WUPSDIR)/wups_elf.ld +LDFLAG_COMMON += +LDFLAGS_MOD += +LDFLAGS_ELF += #--------------------------------------------------------------------------------- Q := @ @@ -99,14 +91,14 @@ MAKEFLAGS += --no-print-directory #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lwups -lutils -ldynamiclibs +ALL_LIBS := $(LIBS) # #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- -LIBDIRS := $(DEVKITPPC) +LIBDIRS += #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional @@ -147,17 +139,16 @@ export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ +export INCLUDE_FULL += $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include \ - -I$(PORTLIBS)/include/libutils -I$(WUPSDIR)/include + $(EXTERNAL_INCLUDE) #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(PORTLIBS)/lib \ - -L$(WUPSDIR)/lib +export LIBPATHS_FULL += $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ + $(EXTERNAL_LIBPATHS) + export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean install @@ -190,16 +181,14 @@ all : $(OUTPUT) # Rule to make the module file. $(OUTPUT) : output.elf @echo "checking for missing symbols ..." - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(LIBS) $(LIBPATHS) -o check_linking.elf + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(ALL_LIBS) $(LIBPATHS_FULL) -o check_linking.elf @echo "linking ..." $@ - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(LIBS) $(LIBPATHS) -o $@ + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ # Rule to make the module file. output.elf : $(OFILES) @echo "linking ... output.elf" - - - @$(LD) $(OFILES) $(LDFLAGS_ELF) $(LIBS) $(LIBPATHS) -o $@ + @$(LD) $(OFILES) $(LDFLAGS_ELF) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ ############################################################################### # Standard build rules @@ -213,17 +202,17 @@ output.elf : $(OFILES) #--------------------------------------------------------------------------------- %.o: %.cpp @echo $(notdir $<) - @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.c @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.S @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.png.o : %.png diff --git a/plugins/overlay/makefile.mk b/plugins/overlay/makefile.mk new file mode 100644 index 0000000..a352000 --- /dev/null +++ b/plugins/overlay/makefile.mk @@ -0,0 +1,47 @@ +# Compiling the projects with libutils logging code? +DO_LOGGING := 1 + +# Target filename +TARGET := $(notdir $(CURDIR)).mod + +# Source directories +SOURCES := src + +# Data directories +DATA := + +# Include directories +INCLUDES := src + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +# Extra C compiler flags +CFLAGS := +# Extra C++ compiler flags +CXXFLAGS := + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(WUPSDIR) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lwups -lutils -ldynamiclibs + +#--------------------------------------------------------------------------------- +# Will be added to the final lib paths +# example: +# -L$C:/library1/lib +#--------------------------------------------------------------------------------- +EXTERNAL_LIBPATHS := + +#--------------------------------------------------------------------------------- +# Will be added to the final include paths +# -IC:/library1/include +#--------------------------------------------------------------------------------- +EXTERNAL_INCLUDE := -I$(PORTLIBS)/include/libutils \ + -I$(WUPSDIR)/include diff --git a/plugins/padcon/Makefile b/plugins/padcon/Makefile index d28c1d1..67f1bad 100644 --- a/plugins/padcon/Makefile +++ b/plugins/padcon/Makefile @@ -1,4 +1,5 @@ -DO_LOGGING := 1 +# You probably never need to adjust this Makefile. +# All changes can be done in the makefile.mk #--------------------------------------------------------------------------------- # Clear the implicit built in rules @@ -33,13 +34,16 @@ export OBJCOPY := $(PREFIX)objcopy #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)).mod BUILD := build -SOURCES := src -DATA := +ifeq ($(notdir $(CURDIR)),$(BUILD)) +include ../makefile.mk +else +include makefile.mk +endif -INCLUDES := src +include $(WUPSDIR)/plugin_makefile.mk -MAP ?= $(TARGET:.mod=.map) +#MAP ?= $(TARGET:.mod=.map) #--------------------------------------------------------------------------------- # options for code generation @@ -75,21 +79,11 @@ ifeq ($(DO_LOGGING), 1) CXXFLAGS += -D__LOGGING__ endif -ASFLAGS := -mregnames -# --relocatable: make sure ld doesn't remove relocations wups will need -# -s: strip local symbols to speed linking -# -u: keep certain sections -# -wrap: wrap function -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain wups sections together) -# -Map: generate a map file +ASFLAGS += -LDFLAG_COMMON += -u wups_load -u wups_meta -u wups_hooks -T $(WUPSDIR)/wups.ld \ - -Wl,-wrap,open,-wrap,close,-wrap,write,-wrap,read,-wrap,lseek,-wrap,stat,-wrap,fstat,-wrap,opendir,-wrap,closedir,-wrap,readdir,-wrap,mkdir \ - -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,--gc-sections - -LDFLAGS_MOD += $(LDFLAG_COMMON),--relocatable -LDFLAGS_ELF += --relocatable -s -T $(WUPSDIR)/wups_elf.ld +LDFLAG_COMMON += +LDFLAGS_MOD += +LDFLAGS_ELF += #--------------------------------------------------------------------------------- Q := @ @@ -97,14 +91,14 @@ MAKEFLAGS += --no-print-directory #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lwups -lutils -ldynamiclibs +ALL_LIBS := $(LIBS) # #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- -LIBDIRS := $(DEVKITPPC) +LIBDIRS += #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional @@ -145,17 +139,16 @@ export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ +export INCLUDE_FULL += $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include \ - -I$(PORTLIBS)/include/libutils -I$(WUPSDIR)/include + $(EXTERNAL_INCLUDE) #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(PORTLIBS)/lib \ - -L$(WUPSDIR)/lib +export LIBPATHS_FULL += $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ + $(EXTERNAL_LIBPATHS) + export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean install @@ -188,16 +181,14 @@ all : $(OUTPUT) # Rule to make the module file. $(OUTPUT) : output.elf @echo "checking for missing symbols ..." - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(LIBS) $(LIBPATHS) -o check_linking.elf + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(ALL_LIBS) $(LIBPATHS_FULL) -o check_linking.elf @echo "linking ..." $@ - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(LIBS) $(LIBPATHS) -o $@ + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ # Rule to make the module file. output.elf : $(OFILES) @echo "linking ... output.elf" - - - @$(LD) $(OFILES) $(LDFLAGS_ELF) $(LIBS) $(LIBPATHS) -o $@ + @$(LD) $(OFILES) $(LDFLAGS_ELF) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ ############################################################################### # Standard build rules @@ -211,17 +202,17 @@ output.elf : $(OFILES) #--------------------------------------------------------------------------------- %.o: %.cpp @echo $(notdir $<) - @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.c @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.S @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.png.o : %.png diff --git a/plugins/padcon/makefile.mk b/plugins/padcon/makefile.mk new file mode 100644 index 0000000..a352000 --- /dev/null +++ b/plugins/padcon/makefile.mk @@ -0,0 +1,47 @@ +# Compiling the projects with libutils logging code? +DO_LOGGING := 1 + +# Target filename +TARGET := $(notdir $(CURDIR)).mod + +# Source directories +SOURCES := src + +# Data directories +DATA := + +# Include directories +INCLUDES := src + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +# Extra C compiler flags +CFLAGS := +# Extra C++ compiler flags +CXXFLAGS := + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(WUPSDIR) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lwups -lutils -ldynamiclibs + +#--------------------------------------------------------------------------------- +# Will be added to the final lib paths +# example: +# -L$C:/library1/lib +#--------------------------------------------------------------------------------- +EXTERNAL_LIBPATHS := + +#--------------------------------------------------------------------------------- +# Will be added to the final include paths +# -IC:/library1/include +#--------------------------------------------------------------------------------- +EXTERNAL_INCLUDE := -I$(PORTLIBS)/include/libutils \ + -I$(WUPSDIR)/include diff --git a/plugins/screenshot/Makefile b/plugins/screenshot/Makefile index 0bf2d6e..67f1bad 100644 --- a/plugins/screenshot/Makefile +++ b/plugins/screenshot/Makefile @@ -1,4 +1,5 @@ -DO_LOGGING := 1 +# You probably never need to adjust this Makefile. +# All changes can be done in the makefile.mk #--------------------------------------------------------------------------------- # Clear the implicit built in rules @@ -33,13 +34,16 @@ export OBJCOPY := $(PREFIX)objcopy #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)).mod BUILD := build -SOURCES := src -DATA := +ifeq ($(notdir $(CURDIR)),$(BUILD)) +include ../makefile.mk +else +include makefile.mk +endif -INCLUDES := src +include $(WUPSDIR)/plugin_makefile.mk -MAP ?= $(TARGET:.mod=.map) +#MAP ?= $(TARGET:.mod=.map) #--------------------------------------------------------------------------------- # options for code generation @@ -75,21 +79,11 @@ ifeq ($(DO_LOGGING), 1) CXXFLAGS += -D__LOGGING__ endif -ASFLAGS := -mregnames -# --relocatable: make sure ld doesn't remove relocations wups will need -# -s: strip local symbols to speed linking -# -u: keep certain sections -# -wrap: wrap function -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain wups sections together) -# -Map: generate a map file +ASFLAGS += -LDFLAG_COMMON += -u wups_load -u wups_meta -u wups_hooks -T $(WUPSDIR)/wups.ld \ - -Wl,-wrap,open,-wrap,close,-wrap,write,-wrap,read,-wrap,lseek,-wrap,stat,-wrap,fstat,-wrap,opendir,-wrap,closedir,-wrap,readdir,-wrap,mkdir \ - -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,--gc-sections - -LDFLAGS_MOD += $(LDFLAG_COMMON),--relocatable -LDFLAGS_ELF += --relocatable -s -T $(WUPSDIR)/wups_elf.ld +LDFLAG_COMMON += +LDFLAGS_MOD += +LDFLAGS_ELF += #--------------------------------------------------------------------------------- Q := @ @@ -97,14 +91,14 @@ MAKEFLAGS += --no-print-directory #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lwups -lutils -ldynamiclibs -lgd -ljpeg +ALL_LIBS := $(LIBS) # #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- -LIBDIRS := $(DEVKITPPC) +LIBDIRS += #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional @@ -145,17 +139,16 @@ export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ +export INCLUDE_FULL += $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include \ - -I$(PORTLIBS)/include/libutils -I$(WUPSDIR)/include + $(EXTERNAL_INCLUDE) #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(PORTLIBS)/lib \ - -L$(WUPSDIR)/lib +export LIBPATHS_FULL += $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ + $(EXTERNAL_LIBPATHS) + export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean install @@ -188,16 +181,14 @@ all : $(OUTPUT) # Rule to make the module file. $(OUTPUT) : output.elf @echo "checking for missing symbols ..." - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(LIBS) $(LIBPATHS) -o check_linking.elf + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(ALL_LIBS) $(LIBPATHS_FULL) -o check_linking.elf @echo "linking ..." $@ - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(LIBS) $(LIBPATHS) -o $@ + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ # Rule to make the module file. output.elf : $(OFILES) @echo "linking ... output.elf" - - - @$(LD) $(OFILES) $(LDFLAGS_ELF) $(LIBS) $(LIBPATHS) -o $@ + @$(LD) $(OFILES) $(LDFLAGS_ELF) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ ############################################################################### # Standard build rules @@ -211,17 +202,17 @@ output.elf : $(OFILES) #--------------------------------------------------------------------------------- %.o: %.cpp @echo $(notdir $<) - @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.c @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.S @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.png.o : %.png diff --git a/plugins/screenshot/makefile.mk b/plugins/screenshot/makefile.mk new file mode 100644 index 0000000..8f6de7f --- /dev/null +++ b/plugins/screenshot/makefile.mk @@ -0,0 +1,47 @@ +# Compiling the projects with libutils logging code? +DO_LOGGING := 1 + +# Target filename +TARGET := $(notdir $(CURDIR)).mod + +# Source directories +SOURCES := src + +# Data directories +DATA := + +# Include directories +INCLUDES := src + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +# Extra C compiler flags +CFLAGS := +# Extra C++ compiler flags +CXXFLAGS := + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(WUPSDIR) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lwups -lutils -ldynamiclibs -lgd -ljpeg + +#--------------------------------------------------------------------------------- +# Will be added to the final lib paths +# example: +# -L$C:/library1/lib +#--------------------------------------------------------------------------------- +EXTERNAL_LIBPATHS := + +#--------------------------------------------------------------------------------- +# Will be added to the final include paths +# -IC:/library1/include +#--------------------------------------------------------------------------------- +EXTERNAL_INCLUDE := -I$(PORTLIBS)/include/libutils \ + -I$(WUPSDIR)/include diff --git a/plugins/sdcafiine/Makefile b/plugins/sdcafiine/Makefile index eed846f..67f1bad 100644 --- a/plugins/sdcafiine/Makefile +++ b/plugins/sdcafiine/Makefile @@ -1,4 +1,5 @@ -DO_LOGGING := 1 +# You probably never need to adjust this Makefile. +# All changes can be done in the makefile.mk #--------------------------------------------------------------------------------- # Clear the implicit built in rules @@ -33,16 +34,16 @@ export OBJCOPY := $(PREFIX)objcopy #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)).mod BUILD := build -SOURCES := src \ - src/common \ - src/myutils \ - src/myfs -DATA := +ifeq ($(notdir $(CURDIR)),$(BUILD)) +include ../makefile.mk +else +include makefile.mk +endif -INCLUDES := src +include $(WUPSDIR)/plugin_makefile.mk -MAP ?= $(TARGET:.mod=.map) +#MAP ?= $(TARGET:.mod=.map) #--------------------------------------------------------------------------------- # options for code generation @@ -71,28 +72,18 @@ CFLAGS += $(COMMON_CFLAGS) -x c -std=c11 # -x c: compile as c++ code # -std=gnu++11: use the c++11 standard -CXXFLAGS += $(COMMON_CFLAGS) -x c++ -std=gnu++11 -D_GNU_SOURCE +CXXFLAGS += $(COMMON_CFLAGS) -x c++ -std=gnu++11 ifeq ($(DO_LOGGING), 1) CFLAGS += -D__LOGGING__ CXXFLAGS += -D__LOGGING__ endif -ASFLAGS := -mregnames -# --relocatable: make sure ld doesn't remove relocations wups will need -# -s: strip local symbols to speed linking -# -u: keep certain sections -# -wrap: wrap function -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain wups sections together) -# -Map: generate a map file +ASFLAGS += -LDFLAG_COMMON += -u wups_load -u wups_meta -u wups_hooks -T $(WUPSDIR)/wups.ld \ - -Wl,-wrap,open,-wrap,close,-wrap,write,-wrap,read,-wrap,lseek,-wrap,stat,-wrap,fstat,-wrap,opendir,-wrap,closedir,-wrap,readdir,-wrap,mkdir \ - -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,-wrap,opendir,--gc-sections - -LDFLAGS_MOD += $(LDFLAG_COMMON),--relocatable -LDFLAGS_ELF += --relocatable -s -T $(WUPSDIR)/wups_elf.ld +LDFLAG_COMMON += +LDFLAGS_MOD += +LDFLAGS_ELF += #--------------------------------------------------------------------------------- Q := @ @@ -100,14 +91,14 @@ MAKEFLAGS += --no-print-directory #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lwups -liosuhax -lfswrapper -lutils -ldynamiclibs +ALL_LIBS := $(LIBS) # #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- -LIBDIRS := $(DEVKITPPC) +LIBDIRS += #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional @@ -148,21 +139,19 @@ export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ +export INCLUDE_FULL += $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include \ - -I$(PORTLIBS)/include/libutils -I$(PORTLIBS)/include/libfswrapper \ - -I$(WUPSDIR)/include + $(EXTERNAL_INCLUDE) #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(PORTLIBS)/lib \ - -L$(WUPSDIR)/lib +export LIBPATHS_FULL += $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ + $(EXTERNAL_LIBPATHS) + export OUTPUT := $(CURDIR)/$(TARGET) -.PHONY: all $(BUILD) clean install +.PHONY: $(BUILD) clean install #--------------------------------------------------------------------------------- $(BUILD): @@ -192,16 +181,14 @@ all : $(OUTPUT) # Rule to make the module file. $(OUTPUT) : output.elf @echo "checking for missing symbols ..." - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(LIBS) $(LIBPATHS) -o check_linking.elf + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(ALL_LIBS) $(LIBPATHS_FULL) -o check_linking.elf @echo "linking ..." $@ - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(LIBS) $(LIBPATHS) -o $@ + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ # Rule to make the module file. output.elf : $(OFILES) @echo "linking ... output.elf" - - - @$(LD) $(OFILES) $(LDFLAGS_ELF) $(LIBS) $(LIBPATHS) -o $@ + @$(LD) $(OFILES) $(LDFLAGS_ELF) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ ############################################################################### # Standard build rules @@ -215,17 +202,17 @@ output.elf : $(OFILES) #--------------------------------------------------------------------------------- %.o: %.cpp @echo $(notdir $<) - @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.c @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.S @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.png.o : %.png diff --git a/plugins/sdcafiine/makefile.mk b/plugins/sdcafiine/makefile.mk new file mode 100644 index 0000000..c18a86e --- /dev/null +++ b/plugins/sdcafiine/makefile.mk @@ -0,0 +1,50 @@ +# Compiling the projects with libutils logging code? +DO_LOGGING := 1 + +# Target filename +TARGET := $(notdir $(CURDIR)).mod + +# Source directories +SOURCES := src \ + src/common \ + src/myfs \ + +# Data directories +DATA := + +# Include directories +INCLUDES := src + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +# Extra C compiler flags +CFLAGS := +# Extra C++ compiler flags +CXXFLAGS := -D_GNU_SOURCE + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(WUPSDIR) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lwups -lfswrapper -lutils -ldynamiclibs + +#--------------------------------------------------------------------------------- +# Will be added to the final lib paths +# example: +# -L$C:/library1/lib +#--------------------------------------------------------------------------------- +EXTERNAL_LIBPATHS := + +#--------------------------------------------------------------------------------- +# Will be added to the final include paths +# -IC:/library1/include +#--------------------------------------------------------------------------------- +EXTERNAL_INCLUDE := -I$(PORTLIBS)/include/libutils \ + -I$(PORTLIBS)/include/libfswrapper \ + -I$(WUPSDIR)/include diff --git a/plugins/sdcafiine/src/patches.cpp b/plugins/sdcafiine/src/patches.cpp index ec670eb..a577041 100644 --- a/plugins/sdcafiine/src/patches.cpp +++ b/plugins/sdcafiine/src/patches.cpp @@ -7,8 +7,8 @@ #include #include #include -#include #include +#include "myfs/fs_utils.h" #include "common/retain_vars.h" #include "common/common.h" #include "main.h" diff --git a/plugins/swipswapme/Makefile b/plugins/swipswapme/Makefile index dc104eb..67f1bad 100644 --- a/plugins/swipswapme/Makefile +++ b/plugins/swipswapme/Makefile @@ -1,4 +1,5 @@ -DO_LOGGING := 1 +# You probably never need to adjust this Makefile. +# All changes can be done in the makefile.mk #--------------------------------------------------------------------------------- # Clear the implicit built in rules @@ -33,15 +34,16 @@ export OBJCOPY := $(PREFIX)objcopy #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)).mod BUILD := build -SOURCES := src \ - src/common \ - src/utils -DATA := +ifeq ($(notdir $(CURDIR)),$(BUILD)) +include ../makefile.mk +else +include makefile.mk +endif -INCLUDES := src +include $(WUPSDIR)/plugin_makefile.mk -MAP ?= $(TARGET:.mod=.map) +#MAP ?= $(TARGET:.mod=.map) #--------------------------------------------------------------------------------- # options for code generation @@ -77,21 +79,11 @@ ifeq ($(DO_LOGGING), 1) CXXFLAGS += -D__LOGGING__ endif -ASFLAGS := -mregnames -# --relocatable: make sure ld doesn't remove relocations wups will need -# -s: strip local symbols to speed linking -# -u: keep certain sections -# -wrap: wrap function -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain wups sections together) -# -Map: generate a map file +ASFLAGS += -LDFLAG_COMMON += -u wups_load -u wups_meta -u wups_hooks -T $(WUPSDIR)/wups.ld \ - -Wl,-wrap,open,-wrap,close,-wrap,write,-wrap,read,-wrap,lseek,-wrap,stat,-wrap,fstat,-wrap,opendir,-wrap,closedir,-wrap,readdir,-wrap,mkdir \ - -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,--gc-sections - -LDFLAGS_MOD += $(LDFLAG_COMMON),--relocatable -LDFLAGS_ELF += --relocatable -s -T $(WUPSDIR)/wups_elf.ld +LDFLAG_COMMON += +LDFLAGS_MOD += +LDFLAGS_ELF += #--------------------------------------------------------------------------------- Q := @ @@ -99,14 +91,14 @@ MAKEFLAGS += --no-print-directory #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lwups -lutils -ldynamiclibs +ALL_LIBS := $(LIBS) # #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- -LIBDIRS := $(DEVKITPPC) +LIBDIRS += #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional @@ -147,17 +139,16 @@ export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ +export INCLUDE_FULL += $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include \ - -I$(PORTLIBS)/include/libutils -I$(WUPSDIR)/include + $(EXTERNAL_INCLUDE) #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(PORTLIBS)/lib \ - -L$(WUPSDIR)/lib +export LIBPATHS_FULL += $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ + $(EXTERNAL_LIBPATHS) + export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean install @@ -190,16 +181,14 @@ all : $(OUTPUT) # Rule to make the module file. $(OUTPUT) : output.elf @echo "checking for missing symbols ..." - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(LIBS) $(LIBPATHS) -o check_linking.elf + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAG_COMMON) $(ALL_LIBS) $(LIBPATHS_FULL) -o check_linking.elf @echo "linking ..." $@ - @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(LIBS) $(LIBPATHS) -o $@ + @$(LD_MOD) ../$(BUILD)/output.elf $(LDFLAGS_MOD) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ # Rule to make the module file. output.elf : $(OFILES) @echo "linking ... output.elf" - - - @$(LD) $(OFILES) $(LDFLAGS_ELF) $(LIBS) $(LIBPATHS) -o $@ + @$(LD) $(OFILES) $(LDFLAGS_ELF) $(ALL_LIBS) $(LIBPATHS_FULL) -o $@ ############################################################################### # Standard build rules @@ -213,17 +202,17 @@ output.elf : $(OFILES) #--------------------------------------------------------------------------------- %.o: %.cpp @echo $(notdir $<) - @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.c @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.o: %.S @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) + @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER) #--------------------------------------------------------------------------------- %.png.o : %.png diff --git a/plugins/swipswapme/makefile.mk b/plugins/swipswapme/makefile.mk new file mode 100644 index 0000000..8039515 --- /dev/null +++ b/plugins/swipswapme/makefile.mk @@ -0,0 +1,49 @@ +# Compiling the projects with libutils logging code? +DO_LOGGING := 1 + +# Target filename +TARGET := $(notdir $(CURDIR)).mod + +# Source directories +SOURCES := src \ + src/common \ + src/utils \ + +# Data directories +DATA := + +# Include directories +INCLUDES := src + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +# Extra C compiler flags +CFLAGS := +# Extra C++ compiler flags +CXXFLAGS := + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(WUPSDIR) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lwups -lutils -ldynamiclibs + +#--------------------------------------------------------------------------------- +# Will be added to the final lib paths +# example: +# -L$C:/library1/lib +#--------------------------------------------------------------------------------- +EXTERNAL_LIBPATHS := + +#--------------------------------------------------------------------------------- +# Will be added to the final include paths +# -IC:/library1/include +#--------------------------------------------------------------------------------- +EXTERNAL_INCLUDE := -I$(PORTLIBS)/include/libutils \ + -I$(WUPSDIR)/include