1
2#     GNU Make makefile for SRB2
3#############################################################################
4# Copyright (C) 1998-2000 by DooM Legacy Team.
5# Copyright (C) 2003-2021 by Sonic Team Junior.
6#
7# This program is free software distributed under the
8# terms of the GNU General Public License, version 2.
9# See the 'LICENSE' file for more details.
10#
11#     -DLINUX     -> use for the GNU/Linux specific
12#     -D_WINDOWS  -> use for the Win32/DirectX specific
13#     -DHAVE_SDL  -> use for the SDL interface
14#
15# Sets:
16#     Compile the SDL/Mingw version with 'make MINGW=1'
17#     Compile the SDL/Linux version with 'make LINUX=1'
18#     Compile the SDL/Solaris version with 'make SOLARIS=1'
19#     Compile the SDL/FreeBSD version with 'gmake FREEBSD=1'
20#     Compile the SDL/Cygwin version with 'make CYGWIN32=1'
21#     Compile the SDL/other version try with 'make SDL=1'
22#
23# 'Targets':
24#     clean
25#       Remove all object files
26#     cleandep
27#       Remove dependency files
28#     distclean
29#       Remove autogenerated files
30#     dll
31#       compile primary HW render DLL/SO
32#     all_dll
33#       compile all HW render and 3D sound DLLs for the set
34#     opengl_dll
35#       Pure Mingw only, compile OpenGL HW render DLL
36#     ds3d_dll
37#       Pure Mingw only, compile DirectX DirectSound HW sound DLL
38#     fmod_dll
39#       Pure Mingw only, compile FMOD HW sound DLL
40#     openal_dll
41#       Pure Mingw only, compile OpenAL HW sound DLL
42#     fmod_so
43#       Non-Mingw, compile FMOD HW sound SO
44#     openal_so
45#       Non-Mingw, compile OpenAL HW sound SO
46#
47#
48# Addon:
49#     To Cross-Compile, CC=gcc-version make * PREFIX=<dir>
50#     Compile with GCC 2.97 version, add 'GCC29=1'
51#     Compile with GCC 4.0x version, add 'GCC40=1'
52#     Compile with GCC 4.1x version, add 'GCC41=1'
53#     Compile with GCC 4.2x version, add 'GCC42=1'
54#     Compile with GCC 4.3x version, add 'GCC43=1'
55#     Compile with GCC 4.4x version, add 'GCC44=1'
56#     Compile with GCC 4.5x version, add 'GCC45=1'
57#     Compile with GCC 4.6x version, add 'GCC46=1'
58#     Compile a profile version, add 'PROFILEMODE=1'
59#     Compile a debug version, add 'DEBUGMODE=1'
60#     Compile with less warnings, add 'RELAXWARNINGS=1'
61#     Generate compiler errors for most compiler warnings, add 'ERRORMODE=1'
62#     Compile without NASM's tmap.nas, add 'NOASM=1'
63#     Compile without 3D hardware support, add 'NOHW=1'
64#     Compile with GDBstubs, add 'RDB=1'
65#     Compile without PNG, add 'NOPNG=1'
66#     Compile without zlib, add 'NOZLIB=1'
67#
68# Addon for SDL:
69#     To Cross-Compile, add 'SDL_CONFIG=/usr/*/bin/sdl-config'
70#     Compile without SDL_Mixer, add 'NOMIXER=1'
71#     Compile without SDL_Mixer_X, add 'NOMIXERX=1' (Win32 only)
72#     Compile without GME, add 'NOGME=1'
73#     Compile without BSD API, add 'NONET=1'
74#     Compile without IPX/SPX, add 'NOIPX=1'
75#     Compile Mingw/SDL with S_DS3S, add 'DS3D=1'
76#     Compile without libopenmpt, add 'NOOPENMPT=1'
77#     Compile with S_FMOD3D, add 'FMOD=1' (WIP)
78#     Compile with S_OPENAL, add 'OPENAL=1' (WIP)
79#     To link with the whole SDL_Image lib to load Icons, add 'SDL_IMAGE=1' but it isn't not realy needed
80#     To link with SDLMain to hide console or make on a console-less binary, add 'SDLMAIN=1'
81#
82#############################################################################
83
84,=,
85
86ifeq (,$(filter-out cleandep clean distclean,$(or $(MAKECMDGOALS),all)))
87CLEANONLY=1
88else ifndef SILENT
89echo=@echo "$(1)"
90ifndef MAKE_RESTARTS
91print=$(info $(1))
92endif
93endif
94
95ALL_SYSTEMS=\
96	PANDORA\
97	LINUX64\
98	MINGW64\
99	HAIKU\
100	DUMMY\
101	DJGPPDOS\
102	MINGW\
103	UNIX\
104	LINUX\
105	SOLARIS\
106	FREEBSD\
107	MACOSX\
108	SDL\
109
110# check for user specified system
111ifeq (,$(filter $(ALL_SYSTEMS),$(.VARIABLES)))
112ifeq ($(OS),Windows_NT) # all windows are Windows_NT...
113
114 $(call print,Detected a Windows system$(,) compiling for 32-bit MinGW SDL2...)
115
116 # go for a 32-bit sdl mingw exe by default
117 MINGW=1
118 WINDOWSHELL=1
119
120else # if you on the *nix
121
122 system:=$(shell uname -s)
123
124 ifeq ($(system),Linux)
125 new_system=LINUX
126 else
127
128 $(error \
129	 Could not automatically detect your system,\
130	 try specifying a system manually)
131
132 endif
133
134 ifeq ($(shell getconf LONG_BIT),64)
135 system+=64-bit
136 new_system:=$(new_system)64
137 endif
138
139 $(call print,Detected $(system) ($(new_system))...)
140 $(new_system)=1
141
142endif
143endif
144
145
146# SRB2 data files
147D_DIR?=../bin/Resources
148D_FILES=$(D_DIR)/srb2.pk3 \
149	$(D_DIR)/player.dta \
150	$(D_DIR)/zones.pk3 \
151	$(D_DIR)/music.dta \
152
153PKG_CONFIG?=pkg-config
154
155ifdef PANDORA
156LINUX=1
157endif
158
159ifdef LINUX64
160LINUX=1
161NONX86=1
162# LINUX64 does not imply X86_64=1; could mean ARM64 or Itanium
163endif
164
165ifdef MINGW64
166MINGW=1
167NONX86=1
168NOASM=1
169# MINGW64 should not necessarily imply X86_64=1, but we make that assumption elsewhere
170# Once that changes, remove this
171X86_64=1
172endif #ifdef MINGW64
173
174ifdef HAIKU
175SDL=1
176endif
177
178include Makefile.cfg
179
180ifdef DUMMY
181NOPNG=1
182NOZLIB=1
183NONET=1
184NOHW=1
185NOASM=1
186NOIPX=1
187EXENAME?=srb2dummy
188OBJS=$(OBJDIR)/i_video.o
189LIBS=-lm
190endif
191
192ifdef HAIKU
193NOIPX=1
194NOASM=1
195ifndef NONET
196LIBS=-lnetwork
197endif
198CFLAGS+=-DUNIXCOMMON
199PNG_CFLAGS?=
200PNG_LDFLAGS?=-lpng
201endif
202
203ifdef PANDORA
204NONX86=1
205NOHW=1
206endif
207
208ifndef NOOPENMPT
209HAVE_OPENMPT=1
210endif
211
212ifdef MINGW
213include win32/Makefile.cfg
214endif #ifdef MINGW
215
216ifdef UNIX
217UNIXCOMMON=1
218endif
219
220ifdef LINUX
221UNIXCOMMON=1
222ifndef NOGME
223HAVE_LIBGME=1
224endif
225endif
226
227ifdef SOLARIS
228UNIXCOMMON=1
229endif
230
231ifdef FREEBSD
232UNIXCOMMON=1
233endif
234
235ifdef MACOSX
236UNIXCOMMON=1
237endif
238
239ifdef SDL
240	include sdl/Makefile.cfg
241endif #ifdef SDL
242
243ifdef DISTCC
244        CC:=distcc $(CC)
245endif
246
247ifdef CCACHE
248        CC:=ccache $(CC)
249endif
250
251MSGFMT?=msgfmt
252
253ifdef WINDOWSHELL
254	COMPTIME=-..\comptime.bat
255else
256	COMPTIME=-../comptime.sh
257endif
258
259ifndef ECHO
260	NASM:=@$(NASM)
261	REMOVE:=@$(REMOVE)
262	CC:=@$(CC)
263	CXX:=@$(CXX)
264	OBJCOPY:=@$(OBJCOPY)
265	OBJDUMP:=@$(OBJDUMP)
266	STRIP:=@$(STRIP)
267	WINDRES:=@$(WINDRES)
268	MKDIR:=@$(MKDIR)
269	GZIP:=@$(GZIP)
270	MSGFMT:=@$(MSGFMT)
271	UPX:=@$(UPX)
272	UPX_OPTS+=-q
273	COMPTIME:=@$(COMPTIME)
274endif
275
276ifdef NONET
277	OPTS+=-DNONET
278	NOCURL=1
279else
280ifdef NO_IPV6
281	OPTS+=-DNO_IPV6
282endif
283endif
284
285ifdef NOHW
286	OPTS+=-DNOHW
287else
288	OPTS+=-DHWRENDER
289	OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \
290		 $(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o \
291		 $(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o
292endif
293
294OPTS += -DCOMPVERSION
295
296ifndef NONX86
297ifndef GCC29
298	ARCHOPTS?=-msse3 -mfpmath=sse
299else
300	ARCHOPTS?=-mpentium
301endif
302else
303ifdef X86_64
304	ARCHOPTS?=-march=nocona
305endif
306endif
307
308ifndef NOASM
309ifndef NONX86
310	OBJS+=$(OBJDIR)/tmap.o $(OBJDIR)/tmap_mmx.o
311	OPTS+=-DUSEASM
312endif
313endif
314
315ifndef NOPNG
316OPTS+=-DHAVE_PNG
317
318ifdef PNG_PKGCONFIG
319PNG_CFLAGS?=$(shell $(PKG_CONFIG) $(PNG_PKGCONFIG) --cflags)
320PNG_LDFLAGS?=$(shell $(PKG_CONFIG) $(PNG_PKGCONFIG) --libs)
321else
322ifdef PREFIX
323PNG_CONFIG?=$(PREFIX)-libpng-config
324else
325PNG_CONFIG?=libpng-config
326endif
327
328ifdef PNG_STATIC
329PNG_CFLAGS?=$(shell $(PNG_CONFIG) --static --cflags)
330PNG_LDFLAGS?=$(shell $(PNG_CONFIG) --static --ldflags)
331else
332PNG_CFLAGS?=$(shell $(PNG_CONFIG) --cflags)
333PNG_LDFLAGS?=$(shell $(PNG_CONFIG) --ldflags)
334endif
335endif
336
337ifdef LINUX
338PNG_CFLAGS+=-D_LARGEFILE64_SOURCE
339endif
340
341LIBS+=$(PNG_LDFLAGS)
342CFLAGS+=$(PNG_CFLAGS)
343
344OBJS+=$(OBJDIR)/apng.o
345endif
346
347ifdef HAVE_LIBGME
348OPTS+=-DHAVE_LIBGME
349
350LIBGME_PKGCONFIG?=libgme
351LIBGME_CFLAGS?=$(shell $(PKG_CONFIG) $(LIBGME_PKGCONFIG) --cflags)
352LIBGME_LDFLAGS?=$(shell $(PKG_CONFIG) $(LIBGME_PKGCONFIG) --libs)
353
354LIBS+=$(LIBGME_LDFLAGS)
355CFLAGS+=$(LIBGME_CFLAGS)
356endif
357
358ifdef HAVE_OPENMPT
359OPTS+=-DHAVE_OPENMPT
360
361LIBOPENMPT_PKGCONFIG?=libopenmpt
362LIBOPENMPT_CFLAGS?=$(shell $(PKG_CONFIG) $(LIBOPENMPT_PKGCONFIG) --cflags)
363LIBOPENMPT_LDFLAGS?=$(shell $(PKG_CONFIG) $(LIBOPENMPT_PKGCONFIG) --libs)
364
365LIBS+=$(LIBOPENMPT_LDFLAGS)
366CFLAGS+=$(LIBOPENMPT_CFLAGS)
367endif
368
369ifndef NOZLIB
370OPTS+=-DHAVE_ZLIB
371ZLIB_PKGCONFIG?=zlib
372ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags)
373ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs)
374
375LIBS+=$(ZLIB_LDFLAGS)
376CFLAGS+=$(ZLIB_CFLAGS)
377else
378NOPNG=1
379endif
380
381ifndef NOCURL
382OPTS+=-DHAVE_CURL
383CURLCONFIG?=curl-config
384CURL_CFLAGS?=$(shell $(CURLCONFIG) --cflags)
385CURL_LDFLAGS?=$(shell $(CURLCONFIG) --libs)
386
387LIBS+=$(CURL_LDFLAGS)
388CFLAGS+=$(CURL_CFLAGS)
389endif
390
391ifdef STATIC
392LIBS:=-static $(LIBS)
393endif
394
395ifdef HAVE_MINIUPNPC
396ifdef NONET
397HAVE_MINIUPNPC=''
398else
399LIBS+=-lminiupnpc
400ifdef MINGW
401LIBS+=-lws2_32 -liphlpapi
402endif
403CFLAGS+=-DHAVE_MINIUPNPC
404endif
405endif
406
407include blua/Makefile.cfg
408
409ifdef NOMD5
410	OPTS+=-DNOMD5
411else
412	OBJS:=$(OBJDIR)/md5.o $(OBJS)
413endif
414
415ifdef NOPOSTPROCESSING
416	OPTS+=-DNOPOSTPROCESSING
417endif
418
419	OPTS:=-fno-exceptions $(OPTS)
420
421ifdef MOBJCONSISTANCY
422	OPTS+=-DMOBJCONSISTANCY
423endif
424
425ifdef PACKETDROP
426	OPTS+=-DPACKETDROP
427endif
428
429ifdef DEBUGMODE
430
431	# build with debugging information
432	WINDRESFLAGS = -D_DEBUG
433ifdef GCC48
434	CFLAGS+=-Og
435else
436	CFLAGS+=-O0
437endif
438	CFLAGS+= -Wall -DPARANOIA -DRANGECHECK -DPACKETDROP
439else
440
441
442	# build a normal optimised version
443	WINDRESFLAGS = -DNDEBUG
444	CFLAGS+=-O3
445endif
446	CFLAGS+=-g $(OPTS) $(ARCHOPTS) $(WINDRESFLAGS)
447
448ifdef YASM
449ifdef STABS
450	NASMOPTS?= -g stabs
451else
452	NASMOPTS?= -g dwarf2
453endif
454else
455	NASMOPTS?= -g
456endif
457
458ifdef PROFILEMODE
459	# build with profiling information
460	CFLAGS+=-pg
461	LDFLAGS+=-pg
462endif
463
464ifdef ZDEBUG
465	CPPFLAGS+=-DZDEBUG
466endif
467
468OPTS+=$(CPPFLAGS)
469
470# default EXENAME if all else fails
471EXENAME?=srb2
472DBGNAME?=$(EXENAME).debug
473
474# $(OBJDIR)/dstrings.o \
475
476# not too sophisticated dependency
477OBJS:=$(i_main_o) \
478		$(OBJDIR)/string.o   \
479		$(OBJDIR)/d_main.o   \
480		$(OBJDIR)/d_clisrv.o \
481		$(OBJDIR)/d_net.o    \
482		$(OBJDIR)/d_netfil.o \
483		$(OBJDIR)/d_netcmd.o \
484		$(OBJDIR)/dehacked.o \
485		$(OBJDIR)/deh_soc.o  \
486		$(OBJDIR)/deh_lua.o  \
487		$(OBJDIR)/deh_tables.o \
488		$(OBJDIR)/z_zone.o   \
489		$(OBJDIR)/f_finale.o \
490		$(OBJDIR)/f_wipe.o   \
491		$(OBJDIR)/g_demo.o   \
492		$(OBJDIR)/g_game.o   \
493		$(OBJDIR)/g_input.o  \
494		$(OBJDIR)/am_map.o   \
495		$(OBJDIR)/command.o  \
496		$(OBJDIR)/console.o  \
497		$(OBJDIR)/hu_stuff.o \
498		$(OBJDIR)/y_inter.o  \
499		$(OBJDIR)/st_stuff.o \
500		$(OBJDIR)/m_aatree.o \
501		$(OBJDIR)/m_anigif.o \
502		$(OBJDIR)/m_argv.o   \
503		$(OBJDIR)/m_bbox.o   \
504		$(OBJDIR)/m_cheat.o  \
505		$(OBJDIR)/m_cond.o   \
506		$(OBJDIR)/m_fixed.o  \
507		$(OBJDIR)/m_menu.o   \
508		$(OBJDIR)/m_misc.o   \
509		$(OBJDIR)/m_perfstats.o \
510		$(OBJDIR)/m_random.o \
511		$(OBJDIR)/m_queue.o  \
512		$(OBJDIR)/info.o     \
513		$(OBJDIR)/p_ceilng.o \
514		$(OBJDIR)/p_enemy.o  \
515		$(OBJDIR)/p_floor.o  \
516		$(OBJDIR)/p_inter.o  \
517		$(OBJDIR)/p_lights.o \
518		$(OBJDIR)/p_map.o    \
519		$(OBJDIR)/p_maputl.o \
520		$(OBJDIR)/p_mobj.o   \
521		$(OBJDIR)/p_polyobj.o\
522		$(OBJDIR)/p_saveg.o  \
523		$(OBJDIR)/p_setup.o  \
524		$(OBJDIR)/p_sight.o  \
525		$(OBJDIR)/p_spec.o   \
526		$(OBJDIR)/p_telept.o \
527		$(OBJDIR)/p_tick.o   \
528		$(OBJDIR)/p_user.o   \
529		$(OBJDIR)/p_slopes.o \
530		$(OBJDIR)/tables.o   \
531		$(OBJDIR)/r_bsp.o    \
532		$(OBJDIR)/r_data.o   \
533		$(OBJDIR)/r_draw.o   \
534		$(OBJDIR)/r_main.o   \
535		$(OBJDIR)/r_plane.o  \
536		$(OBJDIR)/r_segs.o   \
537		$(OBJDIR)/r_skins.o  \
538		$(OBJDIR)/r_sky.o    \
539		$(OBJDIR)/r_splats.o \
540		$(OBJDIR)/r_things.o \
541		$(OBJDIR)/r_textures.o \
542		$(OBJDIR)/r_patch.o \
543		$(OBJDIR)/r_patchrotation.o \
544		$(OBJDIR)/r_picformats.o \
545		$(OBJDIR)/r_portal.o \
546		$(OBJDIR)/screen.o   \
547		$(OBJDIR)/taglist.o  \
548		$(OBJDIR)/v_video.o  \
549		$(OBJDIR)/s_sound.o  \
550		$(OBJDIR)/sounds.o   \
551		$(OBJDIR)/w_wad.o    \
552		$(OBJDIR)/filesrch.o \
553		$(OBJDIR)/mserv.o    \
554		$(OBJDIR)/http-mserv.o\
555		$(OBJDIR)/i_tcp.o    \
556		$(OBJDIR)/lzf.o	     \
557		$(OBJDIR)/vid_copy.o \
558		$(OBJDIR)/b_bot.o \
559		$(i_net_o)      \
560		$(i_system_o)   \
561		$(i_sound_o)    \
562		$(OBJS)
563
564DEPS:=$(patsubst $(OBJDIR)/%.o,$(DEPDIR)/%.d,$(filter %.o,$(OBJS)))
565OBJS+=$(OBJDIR)/comptime.o
566
567ifndef SILENT
568ifndef ECHO
569ifndef NOECHOFILENAMES
570define echoName =
571	@echo -- $< ...
572endef
573endif
574endif
575endif
576
577# List of languages to compile.
578# For reference, this is the command I use to build a srb2.pot file from the source code.
579# (The listed source files are the ones containing translated strings).
580# FILES=""; for file in `find ./ | grep "\.c" | grep -v svn`; do [ "`grep "M_GetText(" $file`" ] && FILES="$FILES $file"; done; xgettext -d srb2 -o locale/srb2.pot -kM_GetText -F --no-wrap $FILES
581ifdef GETTEXT
582POS:=$(BIN)/en.mo
583
584OPTS+=-DGETTEXT
585endif
586
587ifdef PANDORA
588all: $(BIN)/$(PNDNAME)
589endif
590
591
592ifdef SDL
593all: $(BIN)/$(EXENAME)
594endif
595
596ifdef DUMMY
597all:	$(BIN)/$(EXENAME)
598endif
599
600cleandep:
601	$(REMOVE) $(DEPS)
602	$(REMOVE) comptime.h
603
604clean:
605	$(REMOVE) *~ *.flc
606	$(REMOVE) $(OBJDIR)/*.o
607
608distclean: clean cleandep
609
610ifdef MINGW
611	$(REMOVE) $(OBJDIR)/*.res
612endif
613
614ifdef CYGWIN32
615	$(REMOVE) $(OBJDIR)/*.res
616endif
617
618#make a big srb2.s that is the disasm of the exe (dos only ?)
619asm:
620	$(CC) $(LDFLAGS) $(OBJS) -o $(OBJDIR)/tmp.exe $(LIBS)
621	$(OBJDUMP) -d $(OBJDIR)/tmp.exe --no-show-raw-insn > srb2.s
622	$(REMOVE) $(OBJDIR)/tmp.exe
623
624# executable
625# NOTE: DJGPP's objcopy do not have --add-gnu-debuglink
626
627$(BIN)/$(EXENAME): $(POS) $(OBJS)
628	-$(MKDIR) $(BIN)
629	$(call echo,Linking $(EXENAME)...)
630	$(LD) $(LDFLAGS) $(OBJS) -o $(BIN)/$(EXENAME) $(LIBS)
631ifndef VALGRIND
632ifndef NOOBJDUMP
633	$(call echo,Dumping debugging info)
634	$(OBJDUMP) $(OBJDUMP_OPTS) $(BIN)/$(EXENAME) > $(BIN)/$(DBGNAME).txt
635ifdef WINDOWSHELL
636	-$(GZIP) $(GZIP_OPTS) $(BIN)/$(DBGNAME).txt
637else
638	-$(GZIP) $(GZIP_OPT2) $(BIN)/$(DBGNAME).txt
639endif
640endif
641
642# mac os x lsdlsrb2 does not like objcopy
643ifndef MACOSX
644	$(OBJCOPY) $(BIN)/$(EXENAME) $(BIN)/$(DBGNAME)
645	$(OBJCOPY) --strip-debug $(BIN)/$(EXENAME)
646	-$(OBJCOPY) --add-gnu-debuglink=$(BIN)/$(DBGNAME) $(BIN)/$(EXENAME)
647endif
648ifndef NOUPX
649	-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
650endif
651endif
652	$(call echo,Build is done$(,) please look for $(EXENAME) in $(BIN)$(,) (checking for post steps))
653
654reobjdump:
655	$(call echo,Redumping debugging info)
656	$(OBJDUMP) $(OBJDUMP_OPTS) $(BIN)/$(DBGNAME) > $(BIN)/$(DBGNAME).txt
657ifdef WINDOWSHELL
658	-$(GZIP) $(GZIP_OPTS) $(BIN)/$(DBGNAME).txt
659else
660	-$(GZIP) $(GZIP_OPT2) $(BIN)/$(DBGNAME).txt
661endif
662
663$(OBJDIR):
664	-$(MKDIR) $(OBJDIR)
665
666ifdef SDL
667ifdef MINGW
668$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
669 doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
670 command.h hardware/hw_data.h hardware/hw_defs.h \
671 hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
672 hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
673 am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
674 p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
675	$(echoName)
676	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
677else
678$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
679 doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
680 command.h hardware/hw_data.h hardware/hw_defs.h \
681 hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
682 hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
683 am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
684 p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
685	$(echoName)
686	$(CC) $(CFLAGS) $(WFLAGS) -I/usr/X11R6/include -c $< -o $@
687endif
688endif
689
690#dependecy made by gcc itself !
691ifndef DUMMY
692ifndef CLEANONLY
693$(call print,Checking dependency files...)
694-include $(DEPS)
695endif
696endif
697
698undefine deps_rule
699
700# windows makes it too hard !
701ifndef WINDOWSHELL
702ifdef echoName
703define deps_rule =
704	@printf "%-20.20s\r" $<
705
706endef
707endif
708endif
709
710define deps_rule +=
711	$(CC) $(CFLAGS) -M -MF $@ -MT $(OBJDIR)/$(<:.c=.o) $<
712endef
713
714$(DEPDIR)/%.d: %.c
715	$(deps_rule)
716
717$(DEPDIR)/%.d: $(INTERFACE)/%.c
718	$(deps_rule)
719
720$(DEPDIR)/%.d: hardware/%.c
721	$(deps_rule)
722
723$(DEPDIR)/%.d: blua/%.c
724	$(deps_rule)
725
726ifdef VALGRIND
727$(OBJDIR)/z_zone.o: z_zone.c
728	$(echoName)
729	$(CC) $(CFLAGS) $(WFLAGS) -DHAVE_VALGRIND $(VALGRIND_CFLAGS) -c $< -o $@
730endif
731
732$(OBJDIR)/comptime.o::
733ifdef echoName
734	@echo -- comptime.c ...
735endif
736	$(COMPTIME) .
737	$(CC) $(CFLAGS) $(WFLAGS) -c comptime.c -o $@
738
739$(BIN)/%.mo: locale/%.po
740	-$(MKDIR) $(BIN)
741	$(echoName)
742	$(MSGFMT) -f -o $@ $<
743
744$(OBJDIR)/%.o: %.c
745	$(echoName)
746	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
747
748$(OBJDIR)/%.o: $(INTERFACE)/%.c
749	$(echoName)
750	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
751
752ifdef MACOSX
753$(OBJDIR)/%.o: sdl/macosx/%.c
754	$(echoName)
755	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
756endif
757
758$(OBJDIR)/%.o: hardware/%.c
759	$(echoName)
760	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
761
762$(OBJDIR)/%.o: blua/%.c
763	$(echoName)
764	$(CC) $(CFLAGS) $(LUA_CFLAGS) $(WFLAGS) -c $< -o $@
765
766$(OBJDIR)/%.o: %.nas
767	$(echoName)
768	$(NASM) $(NASMOPTS) -o $@ -f $(NASMFORMAT) $<
769
770$(OBJDIR)/vid_copy.o: vid_copy.s asm_defs.inc
771	$(echoName)
772	$(CC) $(OPTS) $(ASFLAGS) -x assembler-with-cpp -c $< -o $@
773
774$(OBJDIR)/%.o: %.s
775	$(echoName)
776	$(CC) $(OPTS) -x assembler-with-cpp -c $< -o $@
777
778$(OBJDIR)/SRB2.res: win32/Srb2win.rc win32/afxres.h win32/resource.h
779	$(echoName)
780	$(WINDRES) -i $< -O rc $(WINDRESFLAGS) --include-dir=win32 -o $@ -O coff
781
782
783ifdef SDL
784
785ifdef MINGW
786$(OBJDIR)/win_dbg.o: win32/win_dbg.c
787	$(echoName)
788	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
789endif
790
791ifdef STATICHS
792$(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
793 hardware/hw_dll.h
794	$(echoName)
795	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
796
797$(OBJDIR)/s_fmod.o: hardware/s_fmod/s_fmod.c hardware/hw3dsdrv.h \
798 hardware/hw_dll.h
799	$(echoName)
800	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
801
802ifdef MINGW
803$(OBJDIR)/s_ds3d.o: hardware/s_ds3d/s_ds3d.c hardware/hw3dsdrv.h \
804 hardware/hw_dll.h
805	$(echoName)
806	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
807endif
808else
809
810$(OBJDIR)/s_fmod.o: hardware/s_fmod/s_fmod.c hardware/hw3dsdrv.h \
811 hardware/hw_dll.h
812	$(echoName)
813	$(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_fmod.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_fmod/s_fmod.c
814
815$(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
816 hardware/hw_dll.h
817	$(echoName)
818	$(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_openal.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_openal/s_openal.c
819endif
820endif
821
822#############################################################
823#
824#############################################################
825