/
Makefile
110 lines (100 loc) · 2.38 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
################################################################
#
# $Id:$
#
# $Log:$
#
CC=clang
AR=llvm-ar-10
# doom was written with the implicit assumption that ints and pointers are 32bit.
# Adding -m32 to make it compile on 64bit archs.
# on Ubuntu 20.04:
# apt install gcc-multilib libx11-dev:i386 libxext-dev:i386
CFLAGS=-m32 -O2 -Wall -Wno-unused-const-variable -DNORMALUNIX -DLINUX
LDFLAGS=-L/usr/X11R6/lib
LIBS=-lXext -lX11 -lnsl -lm
# subdirectory for objects
O=linux
# not too sophisticated dependency
OBJS= \
$(O)/doomdef.o \
$(O)/doomstat.o \
$(O)/dstrings.o \
$(O)/i_system.o \
$(O)/i_sound.o \
$(O)/i_video.o \
$(O)/i_net.o \
$(O)/tables.o \
$(O)/f_finale.o \
$(O)/f_wipe.o \
$(O)/d_main.o \
$(O)/d_net.o \
$(O)/d_items.o \
$(O)/g_game.o \
$(O)/m_menu.o \
$(O)/m_misc.o \
$(O)/m_argv.o \
$(O)/m_bbox.o \
$(O)/m_fixed.o \
$(O)/m_swap.o \
$(O)/m_cheat.o \
$(O)/m_random.o \
$(O)/am_map.o \
$(O)/p_ceilng.o \
$(O)/p_doors.o \
$(O)/p_enemy.o \
$(O)/p_floor.o \
$(O)/p_inter.o \
$(O)/p_lights.o \
$(O)/p_map.o \
$(O)/p_maputl.o \
$(O)/p_plats.o \
$(O)/p_pspr.o \
$(O)/p_setup.o \
$(O)/p_sight.o \
$(O)/p_spec.o \
$(O)/p_switch.o \
$(O)/p_mobj.o \
$(O)/p_telept.o \
$(O)/p_tick.o \
$(O)/p_saveg.o \
$(O)/p_user.o \
$(O)/r_bsp.o \
$(O)/r_data.o \
$(O)/r_draw.o \
$(O)/r_main.o \
$(O)/r_plane.o \
$(O)/r_segs.o \
$(O)/r_sky.o \
$(O)/r_things.o \
$(O)/w_wad.o \
$(O)/wi_stuff.o \
$(O)/v_video.o \
$(O)/st_lib.o \
$(O)/st_stuff.o \
$(O)/hu_stuff.o \
$(O)/hu_lib.o \
$(O)/s_sound.o \
$(O)/z_zone.o \
$(O)/info.o \
$(O)/sounds.o
all: $(O)/linuxxdoom
clean:
rm -f *.o *~ *.flc
rm -f $(O)/*
# link-time optimization only when building the binary, but not when building the *.o files, since we want to link them with rust.
$(O)/linuxxdoom: $(OBJS) $(O)/i_main.o
$(CC) -flto $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_main.o \
-o $(O)/linuxxdoom $(LIBS)
$(O)/%.o: %.c
mkdir -p $(O)
$(CC) $(CFLAGS) -c $< -o $@
run: all
Xephyr :1 -screen 640x400x8 -title DooM &
sleep 1 # ugly!! waiting for Xephyr to start.
DISPLAY=:1 ./$(O)/linuxxdoom -2
$(O)/liblinuxxdoom.a: $(OBJS)
$(AR) rcs $@ $^
#############################################################
#
#############################################################