makefile cleanups
[k8eureka.git] / Makefile
blob961de73dc5a0306b631d5e8eb59866fc4bb70113
2 # --- Eureka Editor ---
4 # Makefile for Unixy system-wide install.
5 # Requires GNU make.
8 PROGRAM=eureka
10 # prefix choices: /usr /usr/local /opt
11 PREFIX ?= /usr/local
13 # flags controlling the dialect of C++
14 CXX_DIALECT=-std=c++14
16 WARNINGS=-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
17 OPTIMISE=-O2 -g
18 UNFUCKERY= -fno-strict-aliasing -fno-strict-overflow -fwrapv -fno-delete-null-pointer-checks
19 STRIP_FLAGS=--strip-unneeded
21 # default flags for compiler, preprocessor and linker
22 CXXFLAGS ?= $(OPTIMISE) $(WARNINGS) $(UNFUCKERY)
23 CPPFLAGS ?=
24 LDFLAGS ?= $(OPTIMISE)
25 LIBS ?=
27 # set this to 0 to use software rendering instead of OpenGL
28 OPENGL = 1
30 # general things needed by Eureka
31 CXXFLAGS += $(CXX_DIALECT)
32 LIBS += -lz -lm
33 FLTK_CONFIG_FLAGS =
35 ifeq ($(OPENGL),1)
36 LIBS += -lGLU -lGL
37 FLTK_CONFIG_FLAGS += --use-gl
38 else
39 CXXFLAGS += -DNO_OPENGL
40 endif
42 # FLTK flags (this assumes a system-wide FLTK installation)
43 FLTK_CONFIG ?= fltk-config
45 CXXFLAGS += $(shell $(FLTK_CONFIG) --use-images --cxxflags $(FLTK_CONFIG_FLAGS))
46 LDFLAGS += $(shell $(FLTK_CONFIG) --use-images --ldflags $(FLTK_CONFIG_FLAGS))
48 # NOTE: the following is commented out since it does not work as expected.
49 # the --libs option gives us static libraries, but --ldflags option
50 # gives us dynamic libraries (and we use --ldflags above).
51 # LIBS += $(shell fltk-config --use-images --libs)
53 OBJ_DIR=obj_linux
55 DUMMY=$(OBJ_DIR)/zzdummy
58 #----- Object files ----------------------------------------------
60 OBJS = \
61 $(OBJ_DIR)/e_basis.o \
62 $(OBJ_DIR)/e_checks.o \
63 $(OBJ_DIR)/e_commands.o \
64 $(OBJ_DIR)/e_cutpaste.o \
65 $(OBJ_DIR)/e_hover.o \
66 $(OBJ_DIR)/e_linedef.o \
67 $(OBJ_DIR)/e_main.o \
68 $(OBJ_DIR)/e_objects.o \
69 $(OBJ_DIR)/e_path.o \
70 $(OBJ_DIR)/e_sector.o \
71 $(OBJ_DIR)/e_things.o \
72 $(OBJ_DIR)/e_vertex.o \
73 $(OBJ_DIR)/im_color.o \
74 $(OBJ_DIR)/im_img.o \
75 $(OBJ_DIR)/lib_adler.o \
76 $(OBJ_DIR)/lib_file.o \
77 $(OBJ_DIR)/lib_tga.o \
78 $(OBJ_DIR)/lib_util.o \
79 $(OBJ_DIR)/main.o \
80 $(OBJ_DIR)/m_bitvec.o \
81 $(OBJ_DIR)/m_config.o \
82 $(OBJ_DIR)/m_editlump.o \
83 $(OBJ_DIR)/m_events.o \
84 $(OBJ_DIR)/m_files.o \
85 $(OBJ_DIR)/m_game.o \
86 $(OBJ_DIR)/m_keys.o \
87 $(OBJ_DIR)/m_loadsave.o \
88 $(OBJ_DIR)/m_nodes.o \
89 $(OBJ_DIR)/m_select.o \
90 $(OBJ_DIR)/m_strings.o \
91 $(OBJ_DIR)/m_testmap.o \
92 $(OBJ_DIR)/m_udmf.o \
93 $(OBJ_DIR)/r_grid.o \
94 $(OBJ_DIR)/r_render.o \
95 $(OBJ_DIR)/r_opengl.o \
96 $(OBJ_DIR)/r_software.o \
97 $(OBJ_DIR)/r_subdiv.o \
98 $(OBJ_DIR)/sys_debug.o \
99 $(OBJ_DIR)/ui_about.o \
100 $(OBJ_DIR)/ui_browser.o \
101 $(OBJ_DIR)/ui_canvas.o \
102 $(OBJ_DIR)/ui_default.o \
103 $(OBJ_DIR)/ui_dialog.o \
104 $(OBJ_DIR)/ui_editor.o \
105 $(OBJ_DIR)/ui_file.o \
106 $(OBJ_DIR)/ui_hyper.o \
107 $(OBJ_DIR)/ui_infobar.o \
108 $(OBJ_DIR)/ui_linedef.o \
109 $(OBJ_DIR)/ui_menu.o \
110 $(OBJ_DIR)/ui_misc.o \
111 $(OBJ_DIR)/ui_nombre.o \
112 $(OBJ_DIR)/ui_pic.o \
113 $(OBJ_DIR)/ui_prefs.o \
114 $(OBJ_DIR)/ui_replace.o \
115 $(OBJ_DIR)/ui_sector.o \
116 $(OBJ_DIR)/ui_scroll.o \
117 $(OBJ_DIR)/ui_sidedef.o \
118 $(OBJ_DIR)/ui_thing.o \
119 $(OBJ_DIR)/ui_tile.o \
120 $(OBJ_DIR)/ui_vertex.o \
121 $(OBJ_DIR)/ui_window.o \
122 $(OBJ_DIR)/w_loadpic.o \
123 $(OBJ_DIR)/w_texture.o \
124 $(OBJ_DIR)/w_wad.o \
125 $(OBJ_DIR)/Errors.o \
127 $(OBJ_DIR)/bsp_level.o \
128 $(OBJ_DIR)/bsp_node.o \
129 $(OBJ_DIR)/bsp_util.o
131 $(OBJ_DIR)/%.o: src/%.cc
132 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ -c $<
135 #----- Targets -----------------------------------------------
137 all: $(DUMMY) $(PROGRAM)
139 clean:
140 rm -f $(PROGRAM) $(OBJ_DIR)/*.[oa]
141 rm -f ERRS LOG.txt update.log core core.*
143 $(PROGRAM): $(OBJS)
144 $(CXX) $^ -o $@ $(LDFLAGS) $(LIBS)
146 # this is used to create the OBJ_DIR directory
147 $(DUMMY):
148 mkdir -p $(OBJ_DIR)
149 @touch $@
151 stripped: all
152 strip $(STRIP_FLAGS) $(PROGRAM)
154 # note that DESTDIR is usually left undefined, and is mainly
155 # useful when making packages for Debian/RedHat/etc...
157 INSTALL_DIR=$(DESTDIR)$(PREFIX)/share/eureka
159 install: all
160 install -d $(DESTDIR)$(PREFIX)/bin
161 install -m 755 $(PROGRAM) $(DESTDIR)$(PREFIX)/bin/
162 install -d $(INSTALL_DIR)/games
163 install -d $(INSTALL_DIR)/common
164 install -d $(INSTALL_DIR)/ports
165 rm -f $(INSTALL_DIR)/games/freedoom.ugh
166 install -m 644 bindings.cfg $(INSTALL_DIR)/bindings.cfg
167 install -m 644 defaults.cfg $(INSTALL_DIR)/defaults.cfg
168 install -m 644 operations.cfg $(INSTALL_DIR)/operations.cfg
169 install -m 644 misc/about_logo.png $(INSTALL_DIR)/about_logo.png
170 install -m 644 games/*.* $(INSTALL_DIR)/games
171 install -m 644 common/*.* $(INSTALL_DIR)/common
172 install -m 644 ports/*.* $(INSTALL_DIR)/ports
174 full-install: install
175 xdg-desktop-menu install --novendor misc/eureka.desktop
176 xdg-icon-resource install --novendor --size 32 misc/eureka.xpm
178 uninstall:
179 rm -v $(DESTDIR)$(PREFIX)/bin/$(PROGRAM)
180 rm -Rv $(INSTALL_DIR)
182 full-uninstall: uninstall
183 xdg-desktop-menu uninstall --novendor misc/eureka.desktop
184 xdg-icon-resource uninstall --novendor --size 32 eureka
186 .PHONY: all clean stripped
188 .PHONY: install uninstall full-install full-uninstall