.PHONY: clean release docs all # IMPORTANT: Dev-C++ doesn't seem to get this right, so you have to copy # make.defaults to make.conf manually if you don't have the latter -include make.conf # basic compiling and linking - rarely changed OPTIONS = -DWINDOWS -DELC $(foreach FEATURE, $(FEATURES), -D$(FEATURE)) CFLAGS=$(PLATFORM) $(CWARN) -O0 -ggdb -pipe $(OPTIONS) -fno-strict-aliasing $(EXTRA_INCLUDES) _CFLAGS=$(PLATFORM) -O2 -fomit-frame-pointer -ffast-math -pipe -fno-strict-aliasing $(EXTRA_INCLUDES) CXXFLAGS=$(PLATFORM) $(CXXWARN) -O0 -ggdb -pipe $(OPTIONS) -fno-strict-aliasing $(EXTRA_INCLUDES) _CXXFLAGS=$(PLATFORM) -O3 -fomit-frame-pointer -ffast-math -pipe -fno-strict-aliasing $(EXTRA_INCLUDES) ZLIB_LIBS = -lz EYE_CANDY_LIBS = -lSDL_image -lpng PNG_SCREENSHOT_LIBS = -lpng # WARNING: the order is important! If -lX uses -lY, then you must list -lX before -lY (sic!) LDFLAGS= $(EXTRA_LIBS) $(foreach FEATURE, $(FEATURES), $($(FEATURE)_LIBS)) \ -llibxml2 -lSDL_net -lsdl -lalut -lopenal32 -lglu32 -lopengl32 -liconv -lvorbisfile -lvorbis -logg -lcal3d -lm -lstdc++ _LDFLAGS=-lopengl32 -lz STATICLIBS=libs/libSDL_net.a libs/libSDL.a libs/libSDL_image.a libs/libopenal.a libs/libvorbisfile.a libs/libvorbis.a libs/libogg.a libs/libxml2.a libs/libcal3d.a libs/libpng.a libs/libasound.a $(EXTRA_STATICLIBS) # the objects we need ENCYCLOPEDIA_COBJ = books/fontdef.o books/parser.o books/symbol.o books/typesetter.o sort.o symbol_table.o MEMORY_DEBUG_COBJ = elmemory.o NEW_E3D_FORMAT_COBJ = io/e3d_io.o io/elc_io.o NEW_FRUSTUM_COBJ = bbox_tree.o NOTEPAD_COBJ = notepad.o SFX_COBJ = special_effects.o TERRAIN_COBJ = normals.o terrain.o USE_LISPSM_COBJ = lispsm.o USE_SHADER_COBJ = shader.o MINIMAP_COBJ = minimap.o COBJS=2d_objects.o 3d_objects.o \ actor_scripts.o actors.o alphamap.o asc.o \ books.o buddy.o bags.o \ cache.o cal.o chat.o colors.o console.o consolewin.o counters.o cursors.o \ dialogues.o draw_scene.o \ elconfig.o elwindows.o encyclopedia.o errors.o events.o \ filter.o font.o framebuffer.o frustum.o \ gamewin.o gl_init.o hud.o help.o highlight.o \ ignore.o init.o interface.o items.o \ keys.o knowledge.o lights.o list.o loginwin.o loading_win.o \ main.o manufacture.o map_io.o mapwin.o \ md5.o misc.o multiplayer.o \ new_actors.o new_character.o \ openingwin.o \ particles.o paste.o pathfinder.o pm_log.o \ questlog.o queue.o reflection.o rules.o \ skills.o sector.o serverpopup.o session.o shadows.o sound.o \ spells.o stats.o storage.o \ tabs.o text.o textures.o tile_map.o timers.o translate.o trade.o \ update.o weather.o widgets.o \ $(foreach FEATURE, $(FEATURES), $($(FEATURE)_COBJ)) EYE_CANDY_CXXOBJ = eye_candy_wrapper.o \ eye_candy/eye_candy.o eye_candy/math_cache.o eye_candy/effect_lamp.o \ eye_candy/effect_candle.o \ eye_candy/effect_campfire.o eye_candy/effect_fountain.o \ eye_candy/effect_teleporter.o eye_candy/effect_firefly.o \ eye_candy/effect_sword.o eye_candy/effect_summon.o \ eye_candy/effect_selfmagic.o eye_candy/effect_targetmagic.o \ eye_candy/effect_ongoing.o eye_candy/effect_impact.o \ eye_candy/effect_smoke.o eye_candy/effect_bag.o eye_candy/effect_cloud.o \ eye_candy/effect_harvesting.o eye_candy/effect_wind.o \ eye_candy/effect_breath.o CXXOBJS=cal3d_wrapper.o \ $(foreach FEATURE, $(FEATURES), $($(FEATURE)_CXXOBJ)) OBJS=$(COBJS) $(CXXOBJS) HEADER_DIRS = . books eye_candy io EXE=el.exe ifndef CC CC=gcc.exe endif ifndef CXX CXX=g++.exe endif ifndef LINK LINK=gcc.exe endif TMP_LIB = libelc.a # the compile targets all: $(EXE); # work around command line length restriction $(TMP_LIB): $(OBJS) rm -f $@ ar q $@ $(filter 2%, $(OBJS)) ar q $@ $(filter 3%, $(OBJS)) ar q $@ $(filter a%, $(OBJS)) ar q $@ $(filter b%, $(OBJS)) ar q $@ $(filter c%, $(OBJS)) ar q $@ $(filter d%, $(OBJS)) ar q $@ $(filter e%, $(OBJS)) ar q $@ $(filter f%, $(OBJS)) ar q $@ $(filter g%, $(OBJS)) ar q $@ $(filter h%, $(OBJS)) ar q $@ $(filter i%, $(OBJS)) ar q $@ $(filter j%, $(OBJS)) ar q $@ $(filter k%, $(OBJS)) ar q $@ $(filter l%, $(OBJS)) ar q $@ $(filter-out main.o, $(filter m%, $(OBJS))) ar q $@ $(filter n%, $(OBJS)) ar q $@ $(filter o%, $(OBJS)) ar q $@ $(filter p%, $(OBJS)) ar q $@ $(filter q%, $(OBJS)) ar q $@ $(filter r%, $(OBJS)) ar q $@ $(filter s%, $(OBJS)) ar q $@ $(filter t%, $(OBJS)) ar q $@ $(filter u%, $(OBJS)) ar q $@ $(filter v%, $(OBJS)) ar q $@ $(filter w%, $(OBJS)) ar q $@ $(filter x%, $(OBJS)) ar q $@ $(filter y%, $(OBJS)) ar q $@ $(filter z%, $(OBJS)) ranlib $@ $(EXE): main.o $(TMP_LIB) $(LINK) $(CFLAGS) $< -L. -lelc $(LDFLAGS) -o $(EXE) #recompile on Makefile or conf change .depend $(OBJS): Makefile.win make.conf $(COBJS): %.o : %.c $(CC) $(CFLAGS) -c -o $@ $< $(CXXOBJS): %.o : %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< release: $(MAKE) -f Makefile.win 'CFLAGS=$(_CFLAGS)' 'CXXFLAGS=$(_CXXFLAGS)' static: $(MAKE) -f Makefile.win 'CFLAGS=$(_CFLAGS)' 'LDFLAGS=$(_LDFLAGS)' 'OBJS=$(OBJS) $(STATICLIBS) -lstdc++ -lGL -lGLU' clean: rm -f $(OBJS) $(EXE) .depend docs: cd docs && doxygen Doxyfile .depend: $(foreach HEADER_DIR, $(HEADER_DIRS), $(wildcard $(HEADER_DIR)/*.h)) $(CC) $(CFLAGS) -MM $(patsubst %.o, %.c, $(COBJS)) >.depend $(CXX) $(CXXFLAGS) -MM $(patsubst %.o, %.cpp, $(CXXOBJS)) >>.depend make.conf: make.defaults @if (test -f $@ -a '$(UPDATE_CONF)' != 'yes'); \ then \ echo '**'; \ echo '* WARNING: $< is newer than $@!'; \ echo '* Proceeding in 10 seconds, hit Ctrl-C to abort...'; \ echo '*'; \ sleep 10; \ else \ cp $< $@; \ fi -include .depend