You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4 KiB

Makefile: Fix parallel build issue
If clean runs in parallel with $(OBJECTS), it is possible to build some
objects first, then the clean target fires and deletes some, and then we
try to link and fail.
Gentoo-Bug: https://bugs.gentoo.org/528218
--- a/makefile
+++ b/makefile
@@ -3,12 +3,12 @@
# Linux using GCC
CXX=c++
-CXXFLAGS=-O2 -Wno-logical-op-parentheses -Wno-switch -Wno-dangling-else
+CXXFLAGS=$(RPM_OPT_FLAGS) -fPIC -DPIC -Wno-parentheses -Wno-switch -Wno-sign-compare -Wno-class-memaccess -Wno-unused-variable -Wno-unused-function -Wno-dangling-else
LIBFLAGS=-fPIC
DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP
STRIP=strip
AR=ar
-LDFLAGS=-pthread
+LDFLAGS=$(RPM_LD_FLAGS) -pthread
DESTDIR=/usr
# Linux using LCC
@@ -142,21 +142,18 @@
@rm -f $(OBJECTS) $(UNRAR_OBJ) $(LIB_OBJ)
@rm -f unrar libunrar.*
-unrar: clean $(OBJECTS) $(UNRAR_OBJ)
- @rm -f unrar
+unrar: $(OBJECTS) $(UNRAR_OBJ)
$(LINK) -o unrar $(LDFLAGS) $(OBJECTS) $(UNRAR_OBJ) $(LIBS)
$(STRIP) unrar
sfx: WHAT=SFX_MODULE
-sfx: clean $(OBJECTS)
- @rm -f default.sfx
+sfx: $(OBJECTS)
$(LINK) -o default.sfx $(LDFLAGS) $(OBJECTS)
$(STRIP) default.sfx
lib: WHAT=RARDLL
lib: CXXFLAGS+=$(LIBFLAGS)
-lib: clean $(OBJECTS) $(LIB_OBJ)
- @rm -f libunrar.*
+lib: $(OBJECTS) $(LIB_OBJ)
$(LINK) -shared -o libunrar.so $(LDFLAGS) $(OBJECTS) $(LIB_OBJ)
$(AR) rcs libunrar.a $(OBJECTS) $(LIB_OBJ)