# Makefile for prc-tools. # # Copyright 1998, 1999, 2002, 2003 John Marshall. # # This is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. srcdir = @srcdir@ VPATH = @srcdir@ CC = @CC@ CFLAGS = @CFLAGS@ CXX = @CXX@ CXXFLAGS = @CXXFLAGS@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ datadir = @datadir@ libdir = @libdir@ m68k_target = @m68k_target@ exeext = @EXEEXT@ INSTALL = @INSTALL@ RANLIB = @RANLIB@ LEX = @LEX@ YACC = @YACC@ # Pretty much any copy of libiberty and libintl (when it is needed) will do; # from one of the binutils builds is as good as anywhere. In a single target # build, BFD from our binutils build is the right one; but when there are # multiple targets, we need the special multi-target one we've built. GENERIC_BINUTILS = ../@first_enabled_target@/binutils SPECIAL_BFD = ../@target_bfd@ # For libraries (like libiberty and pfd) which are generic such that any copy # will do, we can add -L options for our likely locations and search for them # via -l. But for some other libraries (like bfd -- the native one just won't # do) we need our particular version, so we use explicit paths to our copies. BFDLIB = $(SPECIAL_BFD)/libbfd.a INCLUDED_INTLLIBS = $(GENERIC_BINUTILS)/intl/libintl.a INTLLIBS = @INTLLIBS@ INCDIRS = -I. -I$(srcdir) -I$(srcdir)/../binutils/include -I$(SPECIAL_BFD) LIBDIRS = -L. -L$(GENERIC_BINUTILS)/libiberty ALL_CFLAGS = $(INCDIRS) $(CPPFLAGS) $(CFLAGS) ALL_CXXFLAGS = $(INCDIRS) $(CPPFLAGS) $(CXXFLAGS) ALL_LDFLAGS = $(LIBDIRS) $(LDFLAGS) DATADIR_DEFINE = -DDATA_PREFIX=\"$(datadir)/prc-tools\" UTILS_DEFINES = -DPRC_TOOLS_VERSION=\"@prc_tools_version@\" PALMDEV_PREP_DEFINES = \ -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib\" $(DATADIR_DEFINE) \ -DPALMDEV_PREFIX=\"@palmdev_prefix@\" TRAPFILT_DEFINES = $(DATADIR_DEFINE) PFD = libpfd.a GENERIC_PROGS = build-prc$(exeext) palmdev-prep$(exeext) M68K_PROGS = \ obj-res$(exeext) multigen$(exeext) stubgen$(exeext) trapfilt$(exeext) INSTALL_FILES = $(GENERIC_PROGS) $(M68K_PROGS) all: $(INSTALL_FILES) install: $(INSTALL_FILES) $(INSTALL) -d $(DESTDIR)$(bindir) for f in $(GENERIC_PROGS); do \ $(INSTALL) $$f $(DESTDIR)$(bindir)/$$f; \ done if test -n "$(m68k_target)"; then \ for f in $(M68K_PROGS); do \ $(INSTALL) $$f $(DESTDIR)$(bindir)/$(m68k_target)-$$f; \ done; \ fi .PHONY: all install clean .SUFFIXES: .cpp .c.o: $(CC) $(ALL_CFLAGS) -o $@ -c $< .cpp.o: $(CXX) $(ALL_CXXFLAGS) -o $@ -c $< obj_res_objs = obj-res.o binres.o utils.o obj-res$(exeext): $(obj_res_objs) $(PFD) $(CXX) $(ALL_LDFLAGS) -o $@ $(obj_res_objs) \ $(BFDLIB) $(INTLLIBS) -liberty -lpfd $(LIBS) build_prc_objs = build-prc.o binres.o utils.o def.yy.o def.tab.o build-prc$(exeext): $(build_prc_objs) $(PFD) $(CXX) $(ALL_LDFLAGS) -o $@ $(build_prc_objs) \ $(BFDLIB) $(INTLLIBS) -liberty -lpfd $(LIBS) multigen_objs = multigen.o utils.o def.yy.o def.tab.o multigen$(exeext): $(multigen_objs) $(PFD) $(CC) $(ALL_LDFLAGS) -o $@ $(multigen_objs) -liberty -lpfd $(LIBS) stubgen_objs = stubgen.o utils.o def.yy.o def.tab.o stubgen$(exeext): $(stubgen_objs) $(PFD) $(CC) $(ALL_LDFLAGS) -o $@ $(stubgen_objs) -liberty -lpfd $(LIBS) palmdev_prep_objs = palmdev-prep.o utils.o dirutils.o palmdev-prep$(exeext): $(palmdev_prep_objs) $(CC) $(ALL_LDFLAGS) -o $@ $(palmdev_prep_objs) -liberty $(LIBS) trapfilt_objs = trapfilt.o utils.o trapfilt$(exeext): $(trapfilt_objs) $(CC) $(ALL_LDFLAGS) -o $@ $(trapfilt_objs) -liberty $(LIBS) build-prc.o: build-prc.cpp utils.h def.h binres.hpp \ pfd.hpp pfdheader.h pfdio.hpp obj-res.o: obj-res.cpp binres.hpp pfd.hpp pfdheader.h utils.h multigen.o: multigen.c multicode-s.str multicode-ld.str utils.h def.h stubgen.o: stubgen.c glib-jumps-s.str glib-stubs-c.str syslib-dispatch-s.str \ utils.h def.h pfdheader.h binres.o: binres.cpp binres.hpp pfd.hpp pfdheader.h pfdio.hpp utils.h dirutils.o: dirutils.c utils.h utils.o: utils.c utils.h $(CC) $(ALL_CFLAGS) $(UTILS_DEFINES) -c $(srcdir)/utils.c palmdev-prep.o: palmdev-prep.c utils.h $(CC) $(ALL_CFLAGS) $(PALMDEV_PREP_DEFINES) -c $(srcdir)/palmdev-prep.c trapfilt.o: trapfilt.c utils.h $(CC) $(ALL_CFLAGS) $(TRAPFILT_DEFINES) -c $(srcdir)/trapfilt.c def.yy.o: def.yy.c def.tab.h utils.h pfdheader.h def.tab.o: def.tab.c utils.h def.h pfdheader.h def.tab.h: def.tab.c def.yy.c: def.l def.tab.h utils.h pfdheader.h $(LEX) -i -s $(srcdir)/def.l \ && mv lex.yy.c def.yy.c def.tab.c: def.y utils.h def.h pfdheader.h $(YACC) -dv $(srcdir)/def.y \ && mv y.tab.c def.tab.c && mv y.tab.h def.tab.h \ && mv y.output def.output CODIFY = sed -f $(srcdir)/templates/codify.sed glib-jumps-s.str: templates/glib-jumps.s templates/codify.sed $(CODIFY) $(srcdir)/templates/glib-jumps.s > glib-jumps-s.str glib-stubs-c.str: templates/glib-stubs.c templates/codify.sed $(CODIFY) $(srcdir)/templates/glib-stubs.c > glib-stubs-c.str syslib-dispatch-s.str: templates/syslib-dispatch.s templates/codify.sed $(CODIFY) $(srcdir)/templates/syslib-dispatch.s > syslib-dispatch-s.str multicode-s.str: templates/multicode.s templates/codify.sed $(CODIFY) $(srcdir)/templates/multicode.s > multicode-s.str multicode-ld.str: templates/multicode.ld templates/codify.sed $(CODIFY) $(srcdir)/templates/multicode.ld > multicode-ld.str # This PFD library ought eventually to be separated off PFD_OBJS = pfd.o pfdheader.o pfdtime.o pfd.o: pfd.cpp pfd.hpp pfdio.hpp pfdheader.h pfdheader.o: pfdheader.c pfdheader.h pfdtime.o: pfdtime.c pfdheader.h libpfd.a: $(PFD_OBJS) ar cr $@ $(PFD_OBJS) $(RANLIB) $@ clean: -rm -f *.o *.a *.str def.*.* def.output -rm -f $(INSTALL_FILES)