-
-# dfinput
-OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o
-
-# misc
-ifeq "$(HAVE_NEON)" "1"
-OBJS += frontend/libpicofe/arm/neon_scale2x.o
-OBJS += frontend/libpicofe/arm/neon_eagle2x.o
-frontend/libpicofe/arm/neon_scale2x.o: CFLAGS += -DDO_BGR_TO_RGB
-frontend/libpicofe/arm/neon_eagle2x.o: CFLAGS += -DDO_BGR_TO_RGB
+#ifeq "$(CHD_SUPPORT)" "1"
+OBJS += libchdr/src/libchdr_bitstream.o
+OBJS += libchdr/src/libchdr_cdrom.o
+OBJS += libchdr/src/libchdr_chd.o
+OBJS += libchdr/src/libchdr_flac.o
+OBJS += libchdr/src/libchdr_huffman.o
+OBJS += libchdr/deps/lzma-19.00/src/Alloc.o libchdr/deps/lzma-19.00/src/Bra86.o libchdr/deps/lzma-19.00/src/BraIA64.o libchdr/deps/lzma-19.00/src/CpuArch.o libchdr/deps/lzma-19.00/src/Delta.o
+OBJS += libchdr/deps/lzma-19.00/src/LzFind.o libchdr/deps/lzma-19.00/src/Lzma86Dec.o libchdr/deps/lzma-19.00/src/LzmaDec.o libchdr/deps/lzma-19.00/src/LzmaEnc.o libchdr/deps/lzma-19.00/src/Sort.o
+CFLAGS += -DHAVE_CHD -Ilibchdr/include
+libpcsxcore/cdriso.o: CFLAGS += -Wno-unused-function
+libchdr/src/%.o: CFLAGS += -Wno-unused -Ilibchdr/deps/lzma-19.00/include -std=gnu11
+libchdr/deps/lzma-19.00/src/%.o: CFLAGS += -Wno-unused -D_7ZIP_ST -Ilibchdr/deps/lzma-19.00/include
+#endif
+
+# frontend/gui
+OBJS += frontend/cspace.o
+ifeq "$(HAVE_NEON_ASM)" "1"
+OBJS += frontend/cspace_neon.o
+frontend/cspace.o: CFLAGS += -DHAVE_bgr555_to_rgb565 -DHAVE_bgr888_to_x
+else
+ifeq "$(ARCH)" "arm"
+OBJS += frontend/cspace_arm.o
+frontend/cspace.o: CFLAGS += -DHAVE_bgr555_to_rgb565
+endif