-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (27 loc) · 1.69 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
TARGET_EXEC := doom_uds
BUILD_DIR := ./build
SRC_DIRS := ./src
DOOMGENERIC_DIR := ./libs/doomgeneric/doomgeneric
SRCS_DOOM = dummy.c am_map.c doomdef.c doomstat.c dstrings.c d_event.c d_items.c d_iwad.c d_loop.c d_main.c d_mode.c d_net.c f_finale.c f_wipe.c g_game.c hu_lib.c hu_stuff.c info.c i_cdmus.c i_endoom.c i_joystick.c i_scale.c i_sound.c i_system.c i_timer.c memio.c m_argv.c m_bbox.c m_cheat.c m_config.c m_controls.c m_fixed.c m_menu.c m_misc.c m_random.c p_ceilng.c p_doors.c p_enemy.c p_floor.c p_inter.c p_lights.c p_map.c p_maputl.c p_mobj.c p_plats.c p_pspr.c p_saveg.c p_setup.c p_sight.c p_spec.c p_switch.c p_telept.c p_tick.c p_user.c r_bsp.c r_data.c r_draw.c r_main.c r_plane.c r_segs.c r_sky.c r_things.c sha1.c sounds.c statdump.c st_lib.c st_stuff.c s_sound.c tables.c v_video.c wi_stuff.c w_checksum.c w_file.c w_main.c w_wad.c z_zone.c w_file_stdc.c i_input.c i_video.c mus2mid.c doomgeneric.c i_sdlmusic.c i_sdlsound.c
SRCS_DOOM := $(addprefix $(DOOMGENERIC_DIR)/,$(SRCS_DOOM))
OBJS := $(SRCS_DOOM:%=$(BUILD_DIR)/%.o)
SDL_LIBS = `sdl2-config --cflags --libs` -lSDL2_mixer
LDFLAGS+= -lrt -lm -lc -lpthread $(SDL_LIBS)
SRCS := $(shell find $(SRC_DIRS) -name '*.cpp' -or -name '*.c')
OBJS += $(SRCS:%=$(BUILD_DIR)/%.o)
INC_DIRS := $(shell find $(SRC_DIRS) -type d) $(DOOMGENERIC_DIR)
INC_FLAGS := $(addprefix -I,$(INC_DIRS)) $(SDL_LIBS)
CC = gcc
CFLAGS = -DFEATURE_SOUND $(SDL_CFLAGS) -Wall
CPPFLAGS := $(INC_FLAGS) -MMD -MP
$(TARGET_EXEC): $(OBJS)
$(CXX) $(shell find $(BUILD_DIR) -name '*.o') -o $@ $(LDFLAGS)
$(BUILD_DIR)/%.c.o: %.c
mkdir -p $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ $(LIBS)
.PHONY: clean
clean:
rm -rf $(BUILD_DIR)
rm -f $(TARGET_EXEC)
FORCE:
.PHONY: FORCE