Makefile cleanup and copying only required localized resources

svn path=/trunk/netsurf/; revision=11467
This commit is contained in:
Sven Weidauer 2011-01-23 19:03:19 +00:00
parent 037e208299
commit ce2f4da8ac
1 changed files with 22 additions and 31 deletions

View File

@ -4,9 +4,6 @@
POSTEXES += NetSurf.app
$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
LDFLAGS += -L/opt/local/lib
LDFLAGS += -L/usr/X11/lib
LDFLAGS += -lm -lxml2 -lcurl -liconv
LDFLAGS += -lssl -lcrypto -lhubbub -lcss -lparserutils -lwapcaplet
@ -15,9 +12,7 @@
-D_BSD_SOURCE -D_POSIX_C_SOURCE \
-std=c99
# DEBUG
CFLAGS += -g -O0 -Wno-uninitialized
# -DDEBUG=1
CFLAGS += -g -Os -Wno-uninitialized
# shut up zconf.h and zlib.h
#CFLAGS += -D_LARGEFILE64_SOURCE=1
@ -27,12 +22,11 @@
MACOSX_VERSION := 10.5
SDK_PATH := /Developer/SDKs/MacOSX$(MACOSX_VERSION).sdk
SDK_FLAGS := --sysroot=$(SDK_PATH) -mmacosx-version-min=$(MACOSX_VERSION)
SDK_FLAGS := -isysroot $(SDK_PATH) -mmacosx-version-min=$(MACOSX_VERSION)
CFLAGS := $(SDK_FLAGS) $(CFLAGS)
LDFLAGS := $(SDK_FLAGS) -Wl,-syslibroot,$(SDK_PATH) $(LDFLAGS)
CXXFLAGS := $(SDK_FLAGS) $(CXXFLAGS)
CFLAGS += -I/opt/local/include
CFLAGS += -I/usr/X11/include
CFLAGS += -I/usr/include/libxml2
CFLAGS += -Icocoa/PSMTabBarControl
@ -41,28 +35,15 @@
VERSION_FULL := $(shell sed -n '/"/{s/.*"\(.*\)".*/\1/;p;}' desktop/version.c)
VERSION_MAJ := $(shell sed -n '/_major/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
VERSION_MIN := $(shell sed -n '/_minor/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
ifeq ($(HOST),macosx)
CFLAGS +=
else
endif
LDFLAGS += -Wl,-framework,Cocoa -Wl,-framework,Carbon $(NETLDFLAGS)
$(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny)))
ifeq ($(HOST),macosx)
CFLAGS += -I$(PREFIX)/include
LDFLAGS += -L$(PREFIX)/lib
$(eval $(call feature_enabled,BMP,-DWITH_BMP,-lnsbmp,BMP (libnsbmp)))
$(eval $(call feature_enabled,GIF,-DWITH_GIF,-lnsgif,GIF (libnsgif)))
$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
else
NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
endif
$(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny)))
ifneq ($(UNIVERSAL),)
UNIVERSAL_FLAGS := $(foreach arch,$(UNIVERSAL),-arch $(arch) )
@ -126,11 +107,12 @@ S_NIBS := $(S_XIBS:.xib=.nib)
S_XIBS := $(addprefix cocoa/res/,$(S_XIBS))
S_NIBS := $(addprefix $(OBJROOT)/,$(S_NIBS))
R_RESOURCES := default.css adblock.css quirks.css NetSurf.icns \
de.lproj en.lproj fr.lproj it.lproj nl.lproj
R_RESOURCES := default.css adblock.css quirks.css NetSurf.icns
R_RESOURCES := $(addprefix cocoa/res/,$(R_RESOURCES))
LANGUAGES := de en fr it nl
LOCALIZED_RESOURCES := Messages
TABBAR_RESOURCES := AquaTabClose_Front_Pressed.png \
AquaTabClose_Front_Rollover.png \
AquaTabClose_Front.png \
@ -141,9 +123,18 @@ TABBAR_RESOURCES := AquaTabClose_Front_Pressed.png \
AquaTabNewPressed.png \
AquaTabNewRollover.png
R_RESOURCES += $(addprefix cocoa/PSMTabBarControl/Images/,$(TABBAR_RESOURCES))
define make_lproj
R_RESOURCES += $$(OBJROOT)/$(1).lproj
$$(OBJROOT)/$(1).lproj: $(2) $$(OBJROOT)/created
mkdir -p $$@
cp -pLR $(2) $$@
endef
$(foreach lang,$(LANGUAGES),$(eval $(call make_lproj,$(lang),$(addprefix cocoa/res/$(lang).lproj/,$(LOCALIZED_RESOURCES)))))
$(OBJROOT)/MainMenu.nib: cocoa/res/MainMenu.xib $(OBJROOT)/created
ibtool $< --compile $@