1#
2# $Id: Makefile.in,v 1.39 2000/04/02 03:45:36 ejb Exp $
3# $Source: /home/ejb/source/magiccube4d/CVSroot/src/Makefile.in,v $
4# $Author: ejb $
5#
6
7TARGET = magiccube4d
8
9WFLAGS = @WFLAGS@
10DFLAGS =  -pipe -O2 -fno-strict-aliasing
11XINCS = @XINCS@
12INCLUDES = $(XINCS)
13CXXFLAGS = $(DFLAGS) $(WFLAGS) $(INCLUDES)
14CXX = @CXX@
15XLIBS = @XLIBS@
16LIBDIRS = $(XLIBS)
17LIBS = -lm -lXaw -lXmu -lXt -lXext -lX11 @LIBS@
18
19RM = rm -f
20
21OBJS= \
22	Preferences.o \
23	EventHandler.o \
24	History.o \
25	Macro.o \
26        MacroManager.o \
27	Main.o \
28	Math4d.o \
29	Polymgr.o \
30	Puzzlest.o \
31        Machine.o \
32	WidgetsX.o \
33	MachineX.o \
34        PostScriptWriter.o
35
36ASCII_DIST = "ChangeLog *.c *.cpp *.h *.pl MagicCube4d.dsw MagicCube4d.rc MagicCube4d.dsp environment *.txt res/MagicCube4d.rc2"
37BIN_DIST = "Makefile.in configure.in configure res/CURSOR1.CUR res/MagicCube4d.ico res/MagicCube4dDoc.ico res/TOOLBAR.BMP magiccube4d.spec magiccube4d.spec.in prolog.ps"
38
39CONFIGFILES = Makefile magiccube4d.spec
40AUTOFILES = Vec.h PSProlog.h configure $(CONFIGFILES)
41
42DOTVERSION = @DOTVERSION@
43VERSION = @VERSION@
44OS = @OS@
45SRCDIR = $(TARGET)-src-$(VERSION)
46BINDIR = $(TARGET)-$(OS)-bin-$(VERSION)
47SRCZIP = $(SRCDIR).zip
48SRCTGZ = $(SRCDIR).tgz
49BINTGZ = $(BINDIR).tgz
50
51# i386 shouldn't really be hard-coded here, but it's probably not
52# worth the trouble to get rpm to tell us what to call it.  Besides,
53# people who really care will probably be happier not renaming the
54# rpms and can just build the rpms themselves from the tarball.  This
55# is to rename the rpm files to be consistent with the naming
56# conventions used by the rest of our files and to avoid having
57# multiple .'s in the paths which confuses some Windows software.
58BEFORE_SRC_RPMNAME = magiccube4d-$(DOTVERSION)-1.src.rpm
59BEFORE_I386_RPMNAME = magiccube4d-$(DOTVERSION)-1.i386.rpm
60AFTER_SRC_RPMNAME = magiccube4d-src-$(VERSION)-1.rpm
61AFTER_I386_RPMNAME = magiccube4d-@OS@-bin-$(VERSION)-1.rpm
62
63all: $(TARGET)
64
65static: $(TARGET).static
66
67# Support old and new-style pattern rules for maximum flexibility
68.SUFFIXES: .cpp .o
69.cpp.o:
70	$(CXX) -c $(CXXFLAGS) $<
71%.o: %.cpp
72	$(CXX) -c $(CXXFLAGS) $<
73
74$(TARGET): $(OBJS)
75	$(CXX) -o $(TARGET) $(OBJS) $(LIBDIRS) $(LIBS)
76
77$(TARGET).static: $(OBJS)
78	$(CXX) -static -o $(TARGET).static $(OBJS) $(LIBDIRS) $(LIBS)
79
80Vec.h: vec_h.c
81	$(CC) -o vec_h vec_h.c
82	./vec_h 4 > Vec.h
83	$(RM) vec_h
84
85PSProlog.h: prolog.ps make_prolog_cpp.pl
86	perl make_prolog_cpp.pl
87
88TAGS:
89	etags *.cpp *.h
90
91clean:
92	$(RM) *~ *% core *.o vec_h TAGS $(TARGET) $(TARGET).static
93
94distclean: clean
95	$(RM) Makefile config.status config.log config.cache
96	$(RM) -r $(TARGET)-*
97
98# magiccube4d.spec gets removed in realclean rather than distclean
99# even though it is generated by running ./configure.  The reason is
100# that it depends only upon the version, and it needs to be in the
101# distribution for rpm -t to work.
102realclean: distclean
103	$(RM) configure Vec.h PSProlog.h magiccube4d.spec
104
105configure: configure.in
106	autoconf
107
108# config.status is generated by running configure.  No makefile
109# dependency exists since configure can be run with arguments selected
110# by the user, and it will always exist when Makefile exists.  This
111# would only be a problem if someone built directly with Makefile.in
112# or manually removed some files.
113config.status: MagicCube.h
114	@echo "*** rerun ./configure ***"
115	@false
116
117magiccube4d.spec Makefile: config.status
118	./config.status
119
120alldists: zip tgz bindist rpm
121	@echo "Move new rpms to current directory and run make rename-rpm"
122
123zip: $(SRCZIP)
124
125tgz: $(SRCTGZ)
126
127bindist: $(BINTGZ)
128
129rpm: $(SRCTGZ)
130	rpm -ta $(SRCTGZ)
131
132rename-rpm: FORCE
133	mv $(BEFORE_SRC_RPMNAME) $(AFTER_SRC_RPMNAME)
134	mv $(BEFORE_I386_RPMNAME) $(AFTER_I386_RPMNAME)
135
136printobjs:
137	@echo $(OBJS)
138
139$(SRCZIP): $(AUTOFILES) FORCE
140	$(RM) $@
141	zip -l $@ `echo $(ASCII_DIST)`
142	zip $@ `echo $(BIN_DIST)`
143
144$(SRCTGZ): $(AUTOFILES) FORCE
145	$(RM) $(SRCDIR)
146	ln -s . $(SRCDIR)
147	@files=`echo $(ASCII_DIST) $(BIN_DIST)`; \
148	dirfiles=""; \
149	for i in $$files; do \
150		dirfiles="$$dirfiles $(SRCDIR)/$$i"; \
151	done; \
152	tar czvf $@ $$dirfiles
153	rm $(SRCDIR)
154
155$(BINTGZ): $(TARGET).static
156	rm -rf $(BINDIR)
157	mkdir $(BINDIR)
158	cp $(TARGET).static $(BINDIR)/$(TARGET)
159	cp Intro.txt readme-unix.txt MagicCube4D-unix.txt $(BINDIR)
160	strip $(BINDIR)/$(TARGET)
161	$(RM) $(BINTGZ)
162	tar czvf $(BINTGZ) $(BINDIR)
163
164FORCE: ;
165
166# Static dependencies
167EventHandler.o: EventHandler.cpp EventHandler.h History.h Machine.h Macro.h MacroManager.h MagicCube.h Polymgr.h PostScriptWriter.h Preferences.h Puzzlest.h Vec.h Widgets.h
168History.o: History.cpp History.h MagicCube.h Math4d.h Polymgr.h Preferences.h Vec.h
169Machine.o: Machine.cpp EventHandler.h Machine.h MachineX.h MagicCube.h Preferences.h Vec.h
170MachineX.o: MachineX.cpp BitmapsX.h EventHandler.h Machine.h MachineX.h MagicCube.h Preferences.h Puzzlest.h Vec.h Widgets.h WidgetsX.h
171Macro.o: Macro.cpp History.h Macro.h MagicCube.h Math4d.h Polymgr.h Preferences.h Vec.h
172MacroManager.o: MacroManager.cpp History.h Macro.h MacroManager.h MagicCube.h Math4d.h Polymgr.h Preferences.h Vec.h
173Main.o: Main.cpp EventHandler.h MagicCube.h Preferences.h Vec.h
174Math4d.o: Math4d.cpp MagicCube.h Math4d.h Vec.h
175Polymgr.o: Polymgr.cpp MagicCube.h Math4d.h Polymgr.h Preferences.h Vec.h
176PostScriptWriter.o: PostScriptWriter.cpp MagicCube.h PSProlog.h PostScriptWriter.h Puzzlest.h Vec.h
177Preferences.o: Preferences.cpp MagicCube.h Preferences.h Vec.h
178Puzzlest.o: Puzzlest.cpp MagicCube.h Math4d.h Polymgr.h Preferences.h Puzzlest.h Vec.h
179WidgetsX.o: WidgetsX.cpp EventHandler.h MagicCube.h Preferences.h Vec.h Widgets.h WidgetsX.h
180