Permalink
Fetching contributors…
Cannot retrieve contributors at this time
323 lines (275 sloc) 12.1 KB
DISTDIR = ..
SETUP_VERSION = @SETUP_VERSION_MAJOR@.@SETUP_VERSION_MINOR@.@SETUP_VERSION_RELEASE@
PACKAGE = setup-$(SETUP_VERSION)
DATADIR = .
LOCALEDIR = locale
# @SET_MAKE@
arch := @ARCH@
libc := @LIBC@
os := @OS@
BRANDELF = @BRANDELF@
# If you modify this version, change it's setup.xml and release a new patch.
UNINSTALL_VERSION = 1.0.4
CC = @CC@
CXX = @CXX@
AR = @AR@
# This indicates where the 'setupdb' CVS module is checked out
SETUPDB = @SETUPDB@
IMAGE = @IMAGE@
BRAND = @BRAND@
UPDATES = /loki/updates/loki_uninstall
CONVERT_IMAGE = /loki/patch-tools/convert-image
SETUP_GTK = @SETUP_GTK@
# The supported locales so far
LOCALES = fr de es sv it nl ru en_GB
LD = @LD@
OPTIMIZE = @CFLAGS@
LDFLAGS = @LDFLAGS@
BDYNAMIC = @BDYNAMIC@
HEADERS = -I/usr/X11R6/include -I/usr/local/include
OPTIONS = -DSTUB_UI -DSETUP_VERSION_MAJOR=@SETUP_VERSION_MAJOR@ \
-DSETUP_VERSION_MINOR=@SETUP_VERSION_MINOR@ \
-DSETUP_VERSION_RELEASE=@SETUP_VERSION_RELEASE@ \
-DSETUP_VERSION=\"$(SETUP_VERSION)\" -DSU_PATH=\"@SU_PATH@\" \
-DMOUNT_PATH=\"@MOUNT_PATH@\" -DUMOUNT_PATH=\"@UMOUNT_PATH@\" \
-DDATADIR=\"$(DATADIR)\" -DLOCALEDIR=\"$(LOCALEDIR)\" -DLOKI_PREFIX=\"$(BRAND)\"
CFLAGS += $(OPTIMIZE) $(HEADERS) $(OPTIONS)
CXXFLAGS = $(CFLAGS)
COMMON_OBJS = log.o install_log.o
CORE_OBJS = detect.o plugins.o network.o install.o copy.o file.o loki_launchurl.o bools.o
OBJS = $(COMMON_OBJS) $(CORE_OBJS) main.o
LOKI_UNINSTALL_OBJS = loki_uninstall.o uninstall_ui.o
CARBON_UNINSTALL_OBJS = $(COMMON_OBJS) carbon_uninstall.o uninstall_carbonui.o
UNINSTALL_OBJS = $(COMMON_OBJS) uninstall.o
CHECK_OBJS = $(COMMON_OBJS) $(CORE_OBJS) check.o
CHECK_CARBON_OBJS = $(COMMON_OBJS) $(CORE_OBJS) check_carbon.o
CONSOLE_OBJS = $(OBJS) console_ui.o @CONSOLE_OBJS@
GUI_OBJS = $(OBJS) gtk_ui.o
CARBON_OBJS = $(OBJS) carbon_ui.o
XSU_OBJS = xsu.o pseudo.o
SRCS = $(OBJS:.o=.c) $(CONSOLE_OBJS:.o=.c) $(GUI_OBJS:.o=.c) $(CARBON_OBJS:.o=.c) $(XSU_OBJS:.o=.c) testcd.c
COMMON_LIBS = plugins/libplugins.a @COMMON_LIBS@ \
$(SETUPDB)/$(arch)/libsetupdb.a
LIBS = $(COMMON_LIBS) @LIBS@
ifeq ($(os),Linux)
GUI_LIBS = $(COMMON_LIBS) @LIBS@ @GUI_LIBS@
else
GUI_LIBS = $(COMMON_LIBS) @GUI_LIBS@ @LIBS@
endif
CARBON_LIBS = $(COMMON_LIBS) @LIBS@ @CARBON_LIBS@
CONSOLE_LIBS = $(LIBS) @CONSOLE_LIBS@ -lm
all: do-plugins @DO_DIALOG@ setup $(SETUP_GTK) uninstall xsu
testxml: testxml.o
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS) -lm
loki_uninstall.o: uninstall.c
$(LD) $(LDFLAGS) -c -o $@ $^ $(CFLAGS) -DUNINSTALL_UI -DVERSION=\"$(UNINSTALL_VERSION)\"
loki_uninstall: $(LOKI_UNINSTALL_OBJS) $(SETUPDB)/$(arch)/libsetupdb.a
$(LD) $(LDFLAGS) -o $@ $(LOKI_UNINSTALL_OBJS) $(GUI_LIBS)
carbon_uninstall.o: uninstall.c
$(LD) $(LDFLAGS) -c -o $@ $^ $(CFLAGS) -DUNINSTALL_CARBONUI -DUNINSTALL_UI -DVERSION=\"$(UNINSTALL_VERSION)\"
carbon_uninstall: $(CARBON_UNINSTALL_OBJS) $(SETUPDB)/$(arch)/libsetupdb.a
$(LD) $(LDFLAGS) -o $@ $(CARBON_UNINSTALL_OBJS) $(CARBON_LIBS)
rm -f -R ./uninstall.APP
cp -R ./setup.APP ./uninstall.APP
cp ./carbon/Info.plist.uninstall ./uninstall.APP/Contents/Info.plist
rm -f ./uninstall.APP/Contents/MacOS/setup.carbon
cp ./carbon_uninstall ./uninstall.APP/Contents/MacOS
uninstall: $(UNINSTALL_OBJS) $(COMMON_LIBS)
$(LD) $(LDFLAGS) -o $@ $(UNINSTALL_OBJS) $(CONSOLE_LIBS) @STATIC@
check: $(CHECK_OBJS) $(COMMON_LIBS)
$(LD) $(LDFLAGS) -o $@ $(CHECK_OBJS) $(GUI_LIBS)
check.carbon: $(CHECK_CARBON_OBJS) $(COMMON_LIBS)
$(LD) $(LDFLAGS) -o $@ $(CHECK_CARBON_OBJS) $(CARBON_LIBS)
rm -f -R ./check.APP
cp -R ./setup.APP ./check.APP
cp ./carbon/Info.plist.check ./check.APP/Contents/Info.plist
rm -f ./check.APP/Contents/MacOS/setup.carbon
cp ./check.carbon ./check.APP/Contents/MacOS
testcd: testcd.o $(CORE_OBJS) $(COMMON_OBJS) $(COMMON_LIBS)
$(LD) $(LDFLAGS) -o $@ $^ @LIBS@ @CONSOLE_LIBS@ @STATIC@
setup: do-plugins @DO_DIALOG@ $(CONSOLE_OBJS) $(COMMON_LIBS)
$(LD) $(LDFLAGS) -o $@ $(CONSOLE_OBJS) $(CONSOLE_LIBS) @STATIC@
$(SETUP_GTK): $(GUI_OBJS) $(COMMON_LIBS)
$(LD) $(LDFLAGS) -o $@ $(GUI_OBJS) $(GUI_LIBS)
#!!!TODO - Take dependency of dialog libs out of carbon
#!!!TODO - Should we include setup.carbon as part of "all", "install", etc...?
# Carbon needs to be a target all its own
setup.carbon: do-plugins @DO_DIALOG@ $(CARBON_OBJS) $(COMMON_LIBS)
$(LD) $(LDFLAGS) -o $@ $(CARBON_OBJS) $(CARBON_LIBS)
cp setup.carbon setup.APP/Contents/MacOS
xsu: $(XSU_OBJS)
$(LD) $(LDFLAGS) -o $@ $^ @LIBS@ @GUI_LIBS@ @LIBUTIL@ @X11_LIBS@ @LIBINTL@ @EXTRA_LIBS@
do-plugins:
$(MAKE) -C plugins all
do-dialog:
$(MAKE) -C dialog all
install.dbg: all
ifeq ($(DYN_PLUGINS),true)
$(MAKE) -C plugins install.dbg
endif
@if [ -d image/setup.data/bin/$(os)/$(arch)/$(libc) ]; then \
cp setup image/setup.data/bin/$(os)/$(arch); \
cp uninstall image/setup.data/bin/$(os)/$(arch); \
cp $(SETUP_GTK) image/setup.data/bin/$(os)/$(arch)/$(libc); \
fi
install: all
ifeq ($(DYN_PLUGINS),true)
$(MAKE) -C plugins install
endif
@mkdir -p image/setup.data/bin/$(os)/$(arch)/$(libc)
@if [ -d image/setup.data/bin/$(os)/$(arch)/$(libc) ]; then \
cp setup image/setup.data/bin/$(os)/$(arch); \
strip image/setup.data/bin/$(os)/$(arch)/setup; \
$(BRANDELF) -t $(os) image/setup.data/bin/$(os)/$(arch)/setup; \
cp uninstall image/setup.data/bin/$(os)/$(arch); \
strip image/setup.data/bin/$(os)/$(arch)/uninstall; \
$(BRANDELF) -t $(os) image/setup.data/bin/$(os)/$(arch)/uninstall; \
cp xsu image/setup.data/bin/$(os)/$(arch)/$(libc); \
strip image/setup.data/bin/$(os)/$(arch)/$(libc)/xsu; \
$(BRANDELF) -t $(os) image/setup.data/bin/$(os)/$(arch)/$(libc)/xsu; \
cp $(SETUP_GTK) image/setup.data/bin/$(os)/$(arch)/$(libc); \
strip image/setup.data/bin/$(os)/$(arch)/$(libc)/$(SETUP_GTK); \
$(BRANDELF) -t $(os) image/setup.data/bin/$(os)/$(arch)/$(libc)/$(SETUP_GTK); \
else \
echo No directory to copy the binary files to.; \
echo wanted image/setup.data/bin/${os}/${arch}/${libc}; \
fi
install-setup: setup
@if [ -d $(IMAGE)/setup.data/bin/$(os)/$(arch) ]; then \
cp setup $(IMAGE)/setup.data/bin/$(os)/$(arch); \
strip $(IMAGE)/setup.data/bin/$(os)/$(arch)/setup; \
$(BRANDELF) -t $(os) $(IMAGE)/setup.data/bin/$(os)/$(arch)/setup; \
else \
echo No directory to copy the setup binary file to.; \
fi
install-uninstall: uninstall
@if [ -d $(IMAGE)/setup.data/bin/$(os)/$(arch)/ ]; then \
cp uninstall $(IMAGE)/setup.data/bin/$(os)/$(arch)/uninstall; \
strip $(IMAGE)/setup.data/bin/$(os)/$(arch)/uninstall; \
$(BRANDELF) -t $(os) $(IMAGE)/setup.data/bin/$(os)/$(arch)/uninstall; \
else \
echo No directory to copy the uninstall binary file to.; \
fi
install-image: all install-setup install-uninstall
ifeq ($(DYN_PLUGINS),true)
$(MAKE) -C plugins install
endif
@if [ -d $(IMAGE)/setup.data/bin/$(os)/$(arch)/$(libc) ]; then \
cp xsu $(IMAGE)/setup.data/bin/$(os)/$(arch)/$(libc); \
strip $(IMAGE)/setup.data/bin/$(os)/$(arch)/$(libc)/xsu; \
$(BRANDELF) -t $(os) $(IMAGE)/setup.data/bin/$(os)/$(arch)/$(libc)/xsu; \
if [ $(os) = Linux -a -d $(CONVERT_IMAGE) ]; then \
cp uninstall $(CONVERT_IMAGE)/bin/$(os)/$(arch); \
strip $(CONVERT_IMAGE)/bin/$(os)/$(arch)/uninstall; \
$(BRANDELF) -t $(os) $(CONVERT_IMAGE)/bin/$(os)/$(arch)/uninstall; \
fi; \
cp $(SETUP_GTK) $(IMAGE)/setup.data/bin/$(os)/$(arch)/$(libc); \
strip $(IMAGE)/setup.data/bin/$(os)/$(arch)/$(libc)/$(SETUP_GTK); \
else \
echo No directory to copy the binary files to.; \
fi
# Pretty LPP-specific
install-check: check
@if [ -d $(IMAGE)/bin/$(os)/$(arch)/ ]; then \
cp check $(IMAGE)/bin/$(os)/$(arch)/; \
strip $(IMAGE)/bin/$(os)/$(arch)/check; \
cp check.glade check.gtk2.glade $(IMAGE)/misc/; \
else \
echo No directory to copy the binary files to.; \
fi
# Copy loki_uninstall and the required files
copy-loki_uninstall: loki_uninstall
@if [ -d $(IMAGE)/bin/$(os)/$(arch)/bin ]; then \
if [ -d $(IMAGE)/bin/$(os)/$(arch)/bin/@GTK_SUBDIR@ ]; then \
cp loki_uninstall $(IMAGE)/bin/$(os)/$(arch)/bin/@GTK_SUBDIR@/$(BRAND)-uninstall; \
strip $(IMAGE)/bin/$(os)/$(arch)/bin/@GTK_SUBDIR@/$(BRAND)-uninstall; \
else \
cp loki_uninstall $(IMAGE)/bin/$(os)/$(arch)/bin/$(BRAND)-uninstall; \
strip $(IMAGE)/bin/$(os)/$(arch)/bin/$(BRAND)-uninstall; \
fi; \
for file in `find image/setup.data -name loki-uninstall.mo -print`; \
do path="$(IMAGE)/`dirname $$file | sed 's,image/setup.data/,,'`"; \
mkdir -p $$path; \
cp $$file $$path; \
done; \
else \
echo No directory to copy the $(BRAND)-uninstall binary file to.; \
fi
copy-image: install-image copy-loki_uninstall po-image
install-loki_uninstall: loki_uninstall
@if [ -d $(IMAGE)/loki_uninstall/bin/$(arch)/$(libc)/ ]; then \
cp loki_uninstall $(IMAGE)/loki_uninstall/bin/$(arch)/$(libc)/; \
strip $(IMAGE)/loki_uninstall/bin/$(arch)/$(libc)/loki_uninstall; \
cp README.loki_uninstall $(IMAGE)/loki_uninstall/README; \
cp icon.xpm uninstall.glade uninstall.gtk2.glade $(IMAGE)/loki_uninstall/; \
for file in `find image/setup.data -name loki-uninstall.mo -print`; \
do path="$(IMAGE)/loki_uninstall/`dirname $$file | sed 's,image/setup.data/,,'`"; \
mkdir -p $$path; \
cp $$file $$path; \
done; \
else \
echo No directory to copy the binary files to.; \
fi
@if [ -d $(UPDATES) ]; then \
rm -rf $(UPDATES)/bin-$(arch)-$(UNINSTALL_VERSION)/; \
mkdir $(UPDATES)/bin-$(arch)-$(UNINSTALL_VERSION)/; \
cp loki_uninstall $(UPDATES)/bin-$(arch)-$(UNINSTALL_VERSION)/; \
strip $(UPDATES)/bin-$(arch)-$(UNINSTALL_VERSION)/loki_uninstall; \
rm -rf $(UPDATES)/data-$(UNINSTALL_VERSION)/; \
mkdir $(UPDATES)/data-$(UNINSTALL_VERSION)/; \
cp README.loki_uninstall $(UPDATES)/data-$(UNINSTALL_VERSION)/README; \
cp icon.xpm uninstall.glade uninstall.gtk2.glade $(UPDATES)/data-$(UNINSTALL_VERSION)/; \
for file in `find image/setup.data -name loki-uninstall.mo -print`; \
do path="$(UPDATES)/data-$(UNINSTALL_VERSION)/`dirname $$file | sed 's,image/setup.data/,,'`"; \
mkdir -p $$path; \
cp $$file $$path; \
done; \
fi
@echo "Don't forget to update the version in setup.xml to $(UNINSTALL_VERSION)"
po-image:
for lang in $(LOCALES); do \
cp -f image/setup.data/locale/$$lang/LC_MESSAGES/*.mo $(IMAGE)/setup.data/locale/$$lang/LC_MESSAGES/; \
if test -d $(CONVERT_IMAGE); then cp -f image/setup.data/locale/$$lang/LC_MESSAGES/loki-uninstall.mo $(CONVERT_IMAGE)/locale/$$lang/LC_MESSAGES/; fi \
done
clean:
$(MAKE) -C plugins clean
$(MAKE) -C dialog clean
rm -f foo.xml core tags *.o
rm -f carbon/*.o
rm -f unrar/*.o
distclean: clean
rm -f Makefile config.cache config.status config.log
rm -f setup $(SETUP_GTK) setup.carbon uninstall loki_uninstall testxml
dist: distclean
cp -r . $(DISTDIR)/$(PACKAGE)
(cd $(DISTDIR)/$(PACKAGE) && rm -r `find . -name CVS`)
(cd $(DISTDIR)/$(PACKAGE) && rm -r `find . -name .cvsignore`)
(cd $(DISTDIR) && tar zcvf $(PACKAGE).tar.gz $(PACKAGE))
rm -rf $(DISTDIR)/$(PACKAGE)
po/setup.po: $(SRCS) image/setup.data/setup.glade
libglade-xgettext image/setup.data/setup.glade > po/setup.po
xgettext -p po -j -d setup --keyword=_ $(SRCS) plugins/*.c
po/loki-uninstall.po: uninstall.c uninstall_ui.c uninstall.glade
libglade-xgettext uninstall.glade > po/loki-uninstall.po
xgettext -p po -j -d loki-uninstall --keyword=_ uninstall.c uninstall_ui.c
gettext: po/setup.po po/loki-uninstall.po
for lang in $(LOCALES); do \
msgfmt -f po/$$lang/setup.po -o image/setup.data/locale/$$lang/LC_MESSAGES/setup.mo; \
msgfmt -f po/$$lang/loki-uninstall.po -o image/setup.data/locale/$$lang/LC_MESSAGES/loki-uninstall.mo; \
done
# This rule merges changes from the newest PO file in all the translated PO files
update-po: po/setup.po po/loki-uninstall.po
for lang in $(LOCALES); do \
msgmerge po/$$lang/setup.po po/setup.po > po/$$lang/tmp; \
mv po/$$lang/tmp po/$$lang/setup.po; \
msgmerge po/$$lang/loki-uninstall.po po/loki-uninstall.po > po/$$lang/tmp; \
mv po/$$lang/tmp po/$$lang/loki-uninstall.po; \
done
dep: depend
depend:
$(MAKE) -C plugins depend
$(MAKE) -C dialog depend
$(CC) -MM $(CFLAGS) $(SRCS) > .depend
ifeq ($(wildcard .depend),.depend)
include .depend
endif