can you port this makefile for freebsd11 : CFLAGS ?= -O2… · The Chat Archive
Explore can you port this makefile for freebsd11 : CFLAGS ?= -O2 -Wall -Wextra… Save Share Download ▾ Reportcan you port this makefile for freebsd11 : CFLAGS ?= -O2 -Wall -Wextra -Wdeclaration-after-statement
CXXFLAGS ?= -O2 -Wall -Wextra
default programs
CC ?= gcc
AR ?= ar
CXX ?= g++
need zxcvbn.h prior to package installation
CPPFLAGS += -I.
library metadata
TARGET_LIB = libzxcvbn.so.0.0.0
SONAME = libzxcvbn.so.0
WORDS = words-eng_wiki.txt words-female.txt words-male.txt words-passwd.txt words-surname.txt words-tv_film.txt
all: test-file test-inline test-c++inline test-c++file test-shlib test-statlib test-internals
test-shlib: test.c ( T A R G E T L I B ) i f [ ! − e l i b z x c v b n . s o ] ; t h e n l n − s (TARGET_LIB)
if [ ! -e libzxcvbn.so ]; then ln -s ( T A R GE T L I (TARGET_LIB) libzxcvbn.so; fi
(CPPFLAGS) @ (LDFLAGS) -lzxcvbn -lm
Assistant2024-05-22 17:05 UTC Copy response
Copy first prompt
Details
Provider OpenAI
Model provenance As recorded by source dataset
Turns 1 (2 messages)
Language en
Conversation date May 22, 2024
Added to archive Nov 16, 2026
ID 01m7h41px5g2h0rrq3hnk3pta9Source & license Imported from WildChat-4.8M (AI2) (source ). Imported records earn no Research Points.
Upstream record: ecfdae867440b6c0e8878f64b6835d8b
Zhao et al., WildChat: 1M ChatGPT Interaction Logs in the Wild (ICLR 2024). Contains information from WildChat-4.8M, made available under the ODC Attribution License.
License: ODC-BY-1.0
B
)
i
f
[
!
−
e l ib z x c v bn . so ] ; t h e n l n −
s
( C F L A G S ) − o (CFLAGS) -o ( C F L A GS ) − o ( T A R G E T L I B ) : z x c v b n − i n l i n e − p i c . o (TARGET_LIB): zxcvbn-inline-pic.o
( T A R GE T L I B ) : z x c v bn − in l in e − p i c . o (CC) ( C P P F L A G S ) (CPPFLAGS) ( C P P F L A GS ) (CFLAGS)
-o @ @ @ ^ -fPIC -shared -Wl,-soname,( S O N A M E ) (SONAME) ( S O N A M E ) (LDFLAGS) -lm
if [ ! -e ( S O N A M E ) ] ; t h e n l n − s (SONAME) ]; then ln -s ( S O N A M E )] ; t h e n l n − s (TARGET_LIB) $(SONAME); fi
test-statlib: test.c libzxcvbn.a
( C C ) (CC) ( C C ) (CPPFLAGS) ( C F L A G S ) − o (CFLAGS) -o ( C F L A GS ) − o @ ^ (LDFLAGS) -lm
libzxcvbn.a: zxcvbn-inline.o
( A R ) c v q (AR) cvq ( A R ) c v q @ $^
test-file: test.c zxcvbn-file.o
( C C ) (CC) ( C C ) (CPPFLAGS) ( C F L A G S ) − D U S E D I C T F I L E − o t e s t − f i l e t e s t . c z x c v b n − f i l e . o (CFLAGS) \
-DUSE_DICT_FILE -o test-file test.c zxcvbn-file.o ( C F L A GS ) − D U S E D I C T F I L E − o t es t − f i l e t es t . cz x c v bn − f i l e . o (LDFLAGS) -lm
zxcvbn-file.o: zxcvbn.c dict-crc.h zxcvbn.h
( C C ) (CC) ( C C ) (CPPFLAGS) $(CFLAGS)
-DUSE_DICT_FILE -c -o zxcvbn-file.o zxcvbn.c
test-inline: test.c zxcvbn-inline.o
( C C ) (CC) ( C C ) (CPPFLAGS) ( C F L A G S ) − o t e s t − i n l i n e t e s t . c z x c v b n − i n l i n e . o (CFLAGS) \
-o test-inline test.c zxcvbn-inline.o ( C F L A GS ) − o t es t − in l in e t es t . cz x c v bn − in l in e . o (LDFLAGS) -lm
test-internals: test-internals.c zxcvbn.c dict-src.h dict-crc.h zxcvbn.h
( C C ) (CC) ( C C ) (CPPFLAGS) ( C F L A G S ) − o t e s t − i n t e r n a l s t e s t − i n t e r n a l s . c (CFLAGS) \
-o test-internals test-internals.c ( C F L A GS ) − o t es t − in t er na l s t es t − in t er na l s . c (LDFLAGS) -lm
zxcvbn-inline-pic.o: zxcvbn.c dict-src.h zxcvbn.h
( C C ) (CC) ( C C ) (CPPFLAGS) ( C F L A G S ) − f P I C − c − o (CFLAGS) -fPIC -c -o ( C F L A GS ) − f P I C − c − o @ $<
zxcvbn-inline.o: zxcvbn.c dict-src.h zxcvbn.h
( C C ) (CC) ( C C ) (CPPFLAGS) $(CFLAGS) -c -o zxcvbn-inline.o zxcvbn.c
dict-src.h: dictgen ( W O R D S ) . / d i c t g e n − o d i c t − s r c . h (WORDS)
./dictgen -o dict-src.h ( W O R D S ) ./ d i c t g e n − o d i c t − sr c . h (WORDS)
dict-crc.h: dictgen ( W O R D S ) . / d i c t g e n − b − o z x c v b n . d i c t − h d i c t − c r c . h (WORDS)
./dictgen -b -o zxcvbn.dict -h dict-crc.h ( W O R D S ) ./ d i c t g e n − b − oz x c v bn . d i c t − h d i c t − cr c . h (WORDS)
dictgen: dict-generate.cpp makefile
( C X X ) (CXX) ( C X X ) (CPPFLAGS) -std=c++11 ( C X X F L A G S ) − o d i c t g e n d i c t − g e n e r a t e . c p p (CXXFLAGS) \
-o dictgen dict-generate.cpp ( C X X F L A GS ) − o d i c t g e n d i c t − g e n er a t e . c pp (LDFLAGS)
test-c++inline: test.c zxcvbn-c++inline.o
if [ ! -e test.cpp ]; then ln -s test.c test.cpp; fi
( C X X ) (CXX) ( C X X ) (CPPFLAGS) ( C X X F L A G S ) − o t e s t − c + + i n l i n e t e s t . c p p z x c v b n − c + + i n l i n e . o (CXXFLAGS) \
-o test-c++inline test.cpp zxcvbn-c++inline.o ( C X X F L A GS ) − o t es t − c + + in l in e t es t . c pp z x c v bn − c + + in l in e . o (LDFLAGS) -lm
zxcvbn-c++inline.o: zxcvbn.c dict-src.h zxcvbn.h
if [ ! -e zxcvbn.cpp ]; then ln -s zxcvbn.c zxcvbn.cpp; fi
( C X X ) (CXX) ( C X X ) (CPPFLAGS) $(CXXFLAGS)
-c -o zxcvbn-c++inline.o zxcvbn.cpp
test-c++file: test.c zxcvbn-c++file.o
if [ ! -e test.cpp ]; then ln -s test.c test.cpp; fi
( C X X ) (CXX) ( C X X ) (CPPFLAGS) ( C X X F L A G S ) − D U S E D I C T F I L E − o t e s t − c + + f i l e t e s t . c p p z x c v b n − c + + f i l e . o (CXXFLAGS) \
-DUSE_DICT_FILE -o test-c++file test.cpp zxcvbn-c++file.o ( C X X F L A GS ) − D U S E D I C T F I L E − o t es t − c + + f i l e t es t . c pp z x c v bn − c + + f i l e . o (LDFLAGS) -lm
zxcvbn-c++file.o: zxcvbn.c dict-crc.h zxcvbn.h
if [ ! -e zxcvbn.cpp ]; then ln -s zxcvbn.c zxcvbn.cpp; fi
( C X X ) (CXX) ( C X X ) (CPPFLAGS) $(CXXFLAGS)
-DUSE_DICT_FILE -c -o zxcvbn-c++file.o zxcvbn.cpp
test: test-internals test-file test-inline test-c++inline test-c++file test-shlib test-statlib testcases.txt
@echo Testing internals...
./test-internals
@echo Testing C build, dictionary from file
./test-file -t testcases.txt
@echo Testing C build, dictionary in executable
./test-inline -t testcases.txt
@echo Testing C shlib, dictionary in shlib
LD_LIBRARY_PATH=. ./test-shlib -t testcases.txt
@echo Testing C static lib, dictionary in lib
./test-statlib -t testcases.txt
@echo Testing C++ build, dictionary from file
./test-c++file -t testcases.txt
@echo Testing C++ build, dictionary in executable
./test-c++inline -t testcases.txt
@echo Finished
clean:
rm -f test-file zxcvbn-file.o test-c++file zxcvbn-c++file.o
rm -f test-inline test-internals zxcvbn-inline.o zxcvbn-inline-pic.o test-c++inline zxcvbn-c++inline.o
rm -f dict-*.h zxcvbn.dict zxcvbn.cpp test.cpp
rm -f dictgen
rm -f T A R G E T L I B {TARGET_LIB} T A R GE T L I B {SONAME} libzxcvbn.so test-shlib libzxcvbn.a test-statlib
FreeBSD has slightly different conventions and tools compared to Linux when building software, but it can typically compile most Linux-compatible software with minimal adjustments. The Makefile provided appears quite portable, but here are a few specific tweaks for FreeBSD 11:
Specify library paths and tools specific to FreeBSD if necessary.
Ensure that the linker flags and shared library creation flags are appropriate for FreeBSD.
In FreeBSD, the GCC might be called gcc48, gcc49, gcc5, etc., and similarly, g++48, g++49, g++5, etc. It is better to use the default system compiler cc and c++ unless GCC-specific extensions are required.
Here is the tweaked Makefile suitable for FreeBSD 11:
CFLAGS ?= -O2 -Wall -Wextra -Wdeclaration-after-statement
CXXFLAGS ?= -O2 -Wall -Wextra
# default programs
CC ?= cc
AR ?= ar
CXX ?= c++
# need zxcvbn.h prior to package installation
CPPFLAGS += -I.
# library metadata
TARGET_LIB = libzxcvbn.so.0.0.0
SONAME = libzxcvbn.so.0
WORDS = words-eng_wiki.txt words-female.txt words-male.txt words-passwd.txt words-surname.txt words-tv_film.txt
all: test-file test-inline test-c++inline test-c++file test-shlib test-statlib test-internals
test-shlib: test.c $(TARGET_LIB)
@([ ! -e libzxcvbn.so ] && ln -s $(TARGET_LIB) libzxcvbn.so) || true
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< -L. $(LDFLAGS) -lzxcvbn -lm
$(TARGET_LIB): zxcvbn-inline-pic.o
$(CC) $(CPPFLAGS) $(CFLAGS) \
-o $@ $^ -fPIC -shared -Wl,-soname,$(SONAME) $(LDFLAGS) -lm
@([ ! -e $(SONAME) ] && ln -s $(TARGET_LIB) $(SONAME)) || true
test-statlib: test.c libzxcvbn.a
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) -lm
libzxcvbn.a: zxcvbn-inline.o
$(AR) cvq $@ $^
test-file: test.c zxcvbn-file.o
$(CC) $(CPPFLAGS) $(CFLAGS) \
-DUSE_DICT_FILE -o test-file test.c zxcvbn-file.o $(LDFLAGS) -lm
zxcvbn-file.o: zxcvbn.c dict-crc.h zxcvbn.h
$(CC) $(CPPFLAGS) $(CFLAGS) \
-DUSE_DICT_FILE -c -o zxcvbn-file.o zxcvbn.c
test-inline: test.c zxcvbn-inline.o
$(CC) $(CPPFLAGS) $(CFLAGS) \
-o test-inline test.c zxcvbn-inline.o $(LDFLAGS) -lm
test-internals: test-internals.c zxcvbn.c dict-src.h dict-crc.h zxcvbn.h
$(CC) $(CPPFLAGS) $(CFLAGS) \
-o test-internals test-internals.c $(LDFLAGS) -lm
zxcvbn-inline-pic.o: zxcvbn.c dict-src.h zxcvbn.h
$(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c -o $@ $<
zxcvbn-inline.o: zxcvbn.c dict-src.h zxcvbn.h
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o zxcvbn-inline.o zxcvbn.c
dict-src.h: dictgen $(WORDS)
./dictgen -o dict-src.h $(WORDS)
dict-crc.h: dictgen $(WORDS)
./dictgen -b -o zxcvbn.dict -h dict-crc.h $(WORDS)
dictgen: dict-generate.cpp makefile
$(CXX) $(CPPFLAGS) -std=c++11 $(CXXFLAGS) \
-o dictgen dict-generate.cpp $(LDFLAGS)
test-c++inline: test.c zxcvbn-c++inline.o
@([ ! -e test.cpp ] && ln -s test.c test.cpp) || true
$(CXX) $(CPPFLAGS) $(CXXFLAGS) \
-o test-c++inline test.cpp zxcvbn-c++inline.o $(LDFLAGS) -lm
zxcvbn-c++inline.o: zxcvbn.c dict-src.h zxcvbn.h
@([ ! -e zxcvbn.cpp ] && ln -s zxcvbn.c zxcvbn.cpp) || true
$(CXX) $(CPPFLAGS) $(CXXFLAGS) \
-c -o zxcvbn-c++inline.o zxcvbn.cpp
test-c++file: test.c zxcvbn-c++file.o
@([ ! -e test.cpp ] && ln -s test.c test.cpp) || true
$(CXX) $(CPPFLAGS) $(CXXFLAGS) \
-DUSE_DICT_FILE -o test-c++file test.cpp zxcvbn-c++file.o $(LDFLAGS) -lm
zxcvbn-c++file.o: zxcvbn.c dict-crc.h zxcvbn.h
@([ ! -e zxcvbn.cpp ] && ln -s zxcvbn.c zxcvbn.cpp) || true
$(CXX) $(CPPFLAGS) $(CXXFLAGS) \
-DUSE_DICT_FILE -c -o zxcvbn-c++file.o zxcvbn.cpp
test: test-internals test-file test-inline test-c++inline test-c++file test-shlib test-statlib testcases.txt
@echo Testing internals...
./test-internals
@echo Testing C build, dictionary from file
./test-file -t testcases.txt
@echo Testing C build, dictionary in executable
./test-inline -t testcases.txt
@echo Testing C shlib, dictionary in shlib
LD_LIBRARY_PATH=. ./test-shlib -t testcases.txt
@echo Testing C static lib, dictionary in lib
./test-statlib -t testcases.txt
@echo Testing C++ build, dictionary from file
./test-c++file -t testcases.txt
@echo Testing C++ build, dictionary in executable
./test-c++inline -t testcases.txt
@echo Finished
clean:
rm -f test-file zxcvbn-file.o test-c++file zxcvbn-c++file.o
rm -f test-inline test-internals zxcvbn-inline.o zxcvbn-inline-pic.o test-c++inline zxcvbn-c++inline.o
rm -f dict-*.h zxcvbn.dict zxcvbn.cpp test.cpp
rm -f dictgen
rm -f ${TARGET_LIB} ${SONAME} libzxcvbn.so test-shlib libzxcvbn.a test-statlib
Copy first response
Not yet included in a published release.