paulo@0: # Makefile for Allegro version of LOCKJAW
paulo@0: # under Windows and Linux
paulo@0: #
paulo@0: # Copr. 2006-2007 Damian Yerrick
paulo@0: # 
paulo@0: # This work is free software; you can redistribute it and/or modify
paulo@0: # it under the terms of the GNU General Public License as published by
paulo@0: # the Free Software Foundation; either version 2 of the License, or
paulo@0: # (at your option) any later version.
paulo@0: # 
paulo@0: # This program is distributed in the hope that it will be useful,
paulo@0: # but WITHOUT ANY WARRANTY; without even the implied warranty of
paulo@0: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
paulo@0: # GNU General Public License for more details.
paulo@0: # 
paulo@0: # You should have received a copy of the GNU General Public License
paulo@0: # along with this program; if not, write to the Free Software
paulo@0: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
paulo@0: 
paulo@0: 
paulo@0: EXE := lj.exe
paulo@0: CFLAGS := -Wall -O2 -std=gnu99 -DWITH_REPLAY=1 -DHAS_FPU
paulo@0: CC := gcc
paulo@0: LD := gcc
paulo@0: LDFLAGS := -Wall -s -mwindows
paulo@0: srcdir := src
paulo@0: objdir := obj/win32
paulo@0: 
paulo@0: # Set this to the drive letter of your CF or SD card adapter
paulo@0: # so that 'make cf' works
paulo@0: # for info about Ejector by Jim Price, see the GBA makefile
paulo@0: CFDRIVE := h
paulo@0: 
paulo@0: MUSICOBJS := $(objdir)/ljvorbis.o 
paulo@1: #MUSICLIBS := -laldmb -ldumb -lvorbisfile -lvorbis -logg
paulo@1: MUSICLIBS := -lvorbisfile -lvorbis -logg
paulo@0: 
paulo@0: LDLIBS := -lshfolder -ljpgal -lalleg
paulo@0: LINUXLDLIBS := -ljpgal `allegro-config --libs`
paulo@0: DEPOBJS := $(objdir)/ljpc.o $(objdir)/lj.o $(objdir)/ljplay.o \
paulo@0: $(objdir)/pcjoy.o $(objdir)/gimmicks.o $(objdir)/random.o \
paulo@0: $(objdir)/wktables.o $(objdir)/speed.o $(objdir)/options.o \
paulo@0: $(objdir)/debrief.o $(objdir)/macro.o $(objdir)/ljreplay.o \
paulo@0: $(objdir)/ljmusic.o $(objdir)/old_pc_options.o $(objdir)/pcsound.o \
paulo@0: $(objdir)/pcdebrief.o $(objdir)/ljlocale.o $(objdir)/scenario.o \
paulo@0: $(objdir)/ljpath.o \
paulo@0: $(MUSICOBJS)
paulo@0: 
paulo@0: OTHEROBJS := $(objdir)/winicon.o
paulo@0: 
paulo@0: .PHONY: pc clean lj.gba lj.nds cf all run
paulo@0: 
paulo@0: # Scripts to coordinate building the PC, GBA, and DS versions
paulo@0: 
paulo@0: pc: $(EXE)
paulo@0: 
paulo@0: run: $(EXE)
paulo@0: 	./lj
paulo@0: 
paulo@0: all: $(EXE) lj.gba lj.nds
paulo@0: 
paulo@0: cf: /$(CFDRIVE)/gba/lj.gba /$(CFDRIVE)/lj.nds
paulo@0: 	#ejector from http://www.jimprice.com/jim-soft.shtml#eject
paulo@0: 	ejector $(CFDRIVE):
paulo@0: 
paulo@0: /$(CFDRIVE)/gba/lj.gba: lj.gba
paulo@0: 	cp $< $@
paulo@0: 
paulo@0: /$(CFDRIVE)/lj.nds: lj.nds
paulo@0: 	cp $< $@
paulo@0: 
paulo@0: lj.gba:
paulo@0: 	+make -f gbamakefile $@
paulo@0: 
paulo@0: lj.nds:
paulo@0: 	+make -f dsmakefile $@
paulo@0: 
paulo@0: # Content of executable
paulo@0: 
paulo@0: $(EXE): $(DEPOBJS) $(OTHEROBJS)
paulo@0: 	$(LD) $(LDFLAGS) $^ $(MUSICLIBS) $(LDLIBS) -o $@
paulo@0: 
paulo@0: # kesiev's makefile for GNU/Linux
paulo@0: 
paulo@0: linux: $(DEPOBJS)
paulo@0: 	$(LD) $(LDFLAGS) $^ $(MUSICLIBS) $(LINUXLDLIBS) -o lj
paulo@0: 
paulo@0: # Compilation rules
paulo@0: 
paulo@0: $(objdir)/%.o: $(srcdir)/%.c
paulo@0: 	$(CC) $(CFLAGS) -MMD -c -o $@ $<
paulo@0: 	@cp $(objdir)/$*.d $(objdir)/$*.P; \
paulo@0: 	sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
paulo@0: 	-e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
paulo@0: 	rm -f $(objdir)/$*.d
paulo@0: 
paulo@0: $(objdir)/%.o: src/%.rc docs/favicon.ico
paulo@0: 	windres -i $< -o $@
paulo@0: 
paulo@0: # Header dependencies
paulo@0: 
paulo@0: -include $(DEPOBJS:%.o=%.P)
paulo@0: 
paulo@0: 
paulo@0: # Cleanup rules
paulo@0: 
paulo@0: clean:
paulo@0: 	-rm $(objdir)/*.o
paulo@0: 	-rm $(objdir)/*.P