diff --git a/Makefile b/Makefile index c63452a..1ed3e6d 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,14 @@ .SUFFIXES: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) -$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") endif ifeq ($(strip $(DEVKITPRO)),) $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPRO") endif +GITTAG ?= $(shell git describe --tags) + export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH) export PORTLIBS := $(DEVKITPRO)/portlibs/ppc @@ -32,6 +34,7 @@ include $(DEVKITPPC)/base_rules BUILD ?= release SOURCES := source INCLUDES := include +PKGCONFS := pkgconf DATA := LIB := lib @@ -44,11 +47,12 @@ CXXFLAGS = $(CFLAGS) ASFLAGS := -g export WIIUBIN := $(LIB)/libdynamiclibs.a +export PKGCONF := dynamic_libs.pc #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := +LIBS := #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing @@ -69,7 +73,8 @@ export TOPDIR ?= $(CURDIR)/.. export DEPSDIR := $(CURDIR)/$(BUILD) export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ - $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ + $(foreach dir,$(PKGCONFS),$(CURDIR)/$(dir)) CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) @@ -84,12 +89,12 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ -I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include -I$(PORTLIBS)/include - - + + export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) $(PORTLIBS)/lib -.PHONY: $(BUILD) clean +.PHONY: $(BUILD) clean all install #--------------------------------------------------------------------------------- $(BUILD): @@ -99,14 +104,18 @@ $(BUILD): #--------------------------------------------------------------------------------- clean: @echo clean ... - @rm -fr debug release $(LIB) include + @rm -fr debug release $(LIB) include $(PKGCONF) -all: $(WIIUBIN) +all: $(BUILD) -install: +install: $(BUILD) + @mkdir -p $(PORTLIBS)/lib @cp $(BUILD)/lib/libdynamiclibs.a $(PORTLIBS)/lib @mkdir -p $(PORTLIBS)/include/dynamic_libs @cp source/*.h $(PORTLIBS)/include/dynamic_libs + @mkdir -p $(PORTLIBS)/lib/pkgconfig + @cp $(BUILD)/$(PKGCONF) $(PORTLIBS)/lib/pkgconfig + @echo Installed! #--------------------------------------------------------------------------------- else @@ -116,7 +125,13 @@ DEPENDS := $(OFILES:.o=.d) #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- -$(WIIUBIN) : $(OFILES) $(LIB) +all: $(WIIUBIN) $(PKGCONF) + +%.pc: %.pc.in + @sed "s;@PREFIX@;$(PORTLIBS);g" $< > $@ + @sed "s;@VERSION@;$(GITTAG);g" $< > $@ + +$(WIIUBIN): $(OFILES) $(LIB) @rm -f "$(WIIUBIN)" @$(AR) rcs "$(WIIUBIN)" $(OFILES) @echo built ... $(notdir $@) @@ -129,4 +144,3 @@ $(LIB): #--------------------------------------------------------------------------------------- endif #--------------------------------------------------------------------------------------- - diff --git a/pkgconf/dynamic_libs.pc.in b/pkgconf/dynamic_libs.pc.in new file mode 100644 index 0000000..c9a81c6 --- /dev/null +++ b/pkgconf/dynamic_libs.pc.in @@ -0,0 +1,11 @@ +dynamic_libs.pc: +prefix=@PREFIX@ +includedir=${prefix}/include +libdir=${prefix}/lib + +Name: dynamic_libs +Description: Dynamic libs for WiiU homebrew +Version: @VERSION@ + +Cflags: -I${includedir}/dynamic_libs +Libs: -L${libdir} -ldynamiclibs