1srcdir = @srcdir@
2VPATH = @srcdir@
3SHELL = /bin/sh
4CC = @CC@
5LEX = @LEX@
6YACC = @YACC@
7CFLAGS = @CFLAGS@
8YFLAGS = -d
9DEFS = @DEFS@
10ALL_CFLAGS = -I. -I@srcdir@ -I@srcdir@/libami $(DEFS) $(CFLAGS) @X_CFLAGS@
11LIBS = @X_LIBS@ @X_PRE_LIBS@ -Llibami -lami @XT_LIB_KLUDGE@ -lXext -lXmu \
12	-lX11 @X_EXTRA_LIBS@ @LIBS@
13prefix = @prefix@
14exec_prefix = @exec_prefix@
15bindir = $(exec_prefix)/bin
16libdir = $(exec_prefix)/lib
17mandir = $(prefix)/man
18INSTALL = @INSTALL@
19LN_S = @LN_S@
20RM = -rm -f
21LIBAMI = libami/libami.a
22DT_DIR = /etc/dt
23STRIPFLAG = -s
24
25PROGS = amiwm requestchoice executecmd ppmtoinfo
26
27MODULES = $(srcdir)/Background Keyboard
28
29OBJS  = main.o screen.o client.o frame.o icc.o \
30		icon.o menu.o diskobject.o gram.o lex.o rc.o \
31		module.o
32
33SRCS = main.c screen.c client.c frame.c icc.c \
34		icon.c menu.c diskobject.c gram.c lex.c rc.c \
35		module.c \
36		requestchoice.c executecmd.c kbdmodule.c kbdlexer.c
37
38DISTFILES = README README.modules INSTALL LICENSE amiwm.1 \
39	configure configure.in Makefile.in install-sh smakefile scoptions \
40	*.[chly] system.amiwmrc def_*.info *.map \
41	Background Xresources.amiwm.in Amilogo.?m Xsession*.in Xinitrc.in \
42	amiwm-init libami/Makefile.in libami/*.[chly]
43
44PACKAGENAME = amiwm
45
46AMIWM_HOME = $(libdir)/X11/amiwm
47
48all : lib_all
49	@$(MAKE) local_all
50
51local_all : $(PROGS) $(MODULES)
52
53lib_all :
54	@( cd libami; $(MAKE) all )
55
56.c.o:
57	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
58
59menu.o : menu.c
60	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
61
62rc.o : rc.c
63	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
64
65diskobject.o : diskobject.c
66	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
67
68filesystem.o : joke_fs.c
69	$(CC) -o $@ -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
70
71ppmtoinfo.o : ppmtoinfo.c
72	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
73
74gram.h gram.c: gram.y
75	$(YACC) $(YFLAGS) $<
76	mv y.tab.c gram.c
77	mv y.tab.h gram.h
78
79lex.c : lex.l
80	$(LEX) -t $< > lex.c
81
82kbdmodule.h kbdmodule.c: kbdmodule.y
83	$(YACC) $(YFLAGS) $<
84	mv y.tab.c kbdmodule.c
85	mv y.tab.h kbdmodule.h
86
87kbdlexer.c : kbdlexer.l
88	$(LEX) -t $< > kbdlexer.c
89
90install : $(PROGS) $(MODULES) Xsession Xsession2 Xinitrc amiwm-init
91	-mkdir -p $(DESTDIR)$(AMIWM_HOME)
92	$(INSTALL) $(STRIPFLAG) requestchoice $(DESTDIR)$(AMIWM_HOME)/requestchoice
93	$(INSTALL) $(STRIPFLAG) executecmd $(DESTDIR)$(AMIWM_HOME)/executecmd
94	for module in $(MODULES); do \
95	  if [ "$$module" = "$(srcdir)/Background" ]; then \
96	    $(INSTALL) $$module $(DESTDIR)$(AMIWM_HOME)/Background; \
97	  else \
98	    $(INSTALL) $(STRIPFLAG) $$module $(DESTDIR)$(AMIWM_HOME)/$$module; \
99	  fi; \
100	done
101	$(INSTALL) -m 644 $(srcdir)/system.amiwmrc $(DESTDIR)$(AMIWM_HOME)/system.amiwmrc
102	$(INSTALL) -m 644 $(srcdir)/def_tool.info $(DESTDIR)$(AMIWM_HOME)/def_tool.info
103	$(INSTALL) -m 644 $(srcdir)/system.map $(DESTDIR)$(AMIWM_HOME)/system.map
104	$(INSTALL) -m 644 $(srcdir)/magicwb.map $(DESTDIR)$(AMIWM_HOME)/magicwb.map
105	$(INSTALL) -m 644 $(srcdir)/schwartz.map $(DESTDIR)$(AMIWM_HOME)/schwartz.map
106	$(INSTALL) -m 755 Xsession $(DESTDIR)$(AMIWM_HOME)/Xsession
107	$(INSTALL) -m 755 Xsession2 $(DESTDIR)$(AMIWM_HOME)/Xsession2
108	$(INSTALL) -m 755 Xinitrc $(DESTDIR)$(AMIWM_HOME)/Xinitrc
109	$(INSTALL) -m 755 $(srcdir)/amiwm-init $(DESTDIR)$(AMIWM_HOME)/amiwm-init
110	-mkdir -p $(DESTDIR)$(bindir)
111	$(INSTALL) $(STRIPFLAG) amiwm $(DESTDIR)$(bindir)/amiwm
112	$(INSTALL) $(STRIPFLAG) ppmtoinfo $(DESTDIR)$(bindir)/ppmtoinfo
113	$(RM) $(bindir)/requestchoice
114	$(LN_S) $(AMIWM_HOME)/requestchoice $(DESTDIR)$(bindir)/requestchoice
115	-mkdir -p $(DESTDIR)$(mandir)/man1
116	$(INSTALL) -m 644 $(srcdir)/amiwm.1 $(DESTDIR)$(mandir)/man1/amiwm.1
117
118fs-install : Filesystem
119	$(INSTALL) $(STRIPFLAG) Filesystem $(AMIWM_HOME)/Filesystem
120	$(INSTALL) -m 644 def_disk.info $(AMIWM_HOME)/def_disk.info
121	$(INSTALL) -m 644 def_drawer.info $(AMIWM_HOME)/def_disk.info
122
123cde-install : Xresources.amiwm Amilogo.bm Amilogo.pm
124	-mkdir -p $(DT_DIR)/config/C/Xresources.d
125	$(INSTALL) -m 644 Xresources.amiwm $(DT_DIR)/config/C/Xresources.d/Xresources.amiwm
126	-mkdir -p $(DT_DIR)/appconfig/icons/C
127	$(INSTALL) -m 644 Amilogo.bm $(DT_DIR)/appconfig/icons/C/Amilogo.bm
128	$(INSTALL) -m 644 Amilogo.pm $(DT_DIR)/appconfig/icons/C/Amilogo.pm
129
130
131amiwm : $(OBJS) $(LIBAMI)
132	$(CC) -o amiwm $(OBJS) $(LIBS)
133
134requestchoice : requestchoice.o $(LIBAMI)
135	$(CC) -o requestchoice requestchoice.o $(LIBS)
136
137executecmd : executecmd.o $(LIBAMI)
138	$(CC) -o executecmd executecmd.o $(LIBS)
139
140Filesystem : filesystem.o $(LIBAMI)
141	$(CC) -o Filesystem filesystem.o $(LIBS)
142
143Keyboard : kbdmodule.o kbdlexer.o $(LIBAMI)
144	$(CC) -o Keyboard kbdmodule.o kbdlexer.o $(LIBS)
145
146ppmtoinfo : ppmtoinfo.o
147	$(CC) -o ppmtoinfo ppmtoinfo.o -lm
148
149localetest : localetest.o $(LIBAMI)
150	$(CC) -o localetest localetest.o $(LIBS)
151
152clean :
153	$(RM) core $(PROGS) $(LIBAMI) Keyboard *.o libami/*.o
154	$(RM) lex.yy.c lex.c y.tab.c y.tab.h gram.h gram.c
155	$(RM) kbdlexer.c kbdmodule.h kbdmodule.c
156	$(RM) config.log
157
158distclean : clean
159	$(RM) config.status config.cache *~
160	$(RM) Makefile libami/Makefile Xresources.amiwm Xsession Xsession2 Xinitrc
161
162spotless : distclean
163
164TAGS:
165	etags *.[ch] libami/*.[ch]
166
167patch :
168	mv version.h old_version.h
169	sed < old_version.h 's/l/"/' | awk '-F"' '{ printf "%s\"%sl%s\"\n",$$1,$$2,1+$$3 }' > version.h
170	rm old_version.h
171
172dist : version.h clean
173	( version=`sed < version.h -e 's/^[^"]*"//' -e 's/"[^"]*$$//'`; \
174	  tarname="$(PACKAGENAME)$$version.tar"; \
175	  mkdir $(PACKAGENAME)$$version; \
176	  tar cf - $(DISTFILES) | (cd $(PACKAGENAME)$$version/; tar xf - ); \
177	  rm -f $$tarname $$tarname.gz; \
178	  tar cf $$tarname $(PACKAGENAME)$$version; \
179	  rm -rf $(PACKAGENAME)$$version; \
180	  gzip $$tarname; \
181	)
182
183$(srcdir)/configure: $(srcdir)/configure.in
184	autoconf $(srcdir)/configure.in > $(srcdir)/configure
185
186config.status: $(srcdir)/configure
187	$(srcdir)/configure
188
189Makefile: $(srcdir)/Makefile.in config.status
190	./config.status
191
192libami/Makefile: $(srcdir)/libami/Makefile.in config.status
193	./config.status
194
195Xresources.amiwm: $(srcdir)/Xresources.amiwm.in
196	sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xresources.amiwm.in > Xresources.amiwm
197
198Xsession: $(srcdir)/Xsession.in config.status
199	sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xsession.in > Xsession
200
201Xsession2: $(srcdir)/Xsession2.in config.status
202	sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xsession2.in > Xsession2
203
204Xinitrc: $(srcdir)/Xinitrc.in config.status
205	sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xinitrc.in > Xinitrc
206
207
208depend:: $(SRCS)
209	-@rm Makefile.bak
210	mv Makefile Makefile.bak
211	( sed '/^#--DO NOT REMOVE THIS LINE--$$/q' < Makefile.bak ; \
212	  $(CC) -MM $(ALL_CFLAGS) $(SRCS) ) > Makefile
213
214depend::
215	@( cd libami; $(MAKE) depend )
216
217#--DO NOT REMOVE THIS LINE--
218