Skip to content

Commit

Permalink
Move cflags _before_ automatically added include paths.
Browse files Browse the repository at this point in the history
Lets the user override paths and not be forced into certain system
headers that are unwanted.
  • Loading branch information
bakpakin committed Dec 22, 2024
1 parent e239392 commit 3348318
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spork/cc.janet
Original file line number Diff line number Diff line change
Expand Up @@ -196,37 +196,37 @@
(defn compile-c
"Compile a C program to an object file. Return the command arguments."
[from to]
(exec [(cc) (ccstd) ;(opt) ;(extra-paths) "-fPIC" ;(cflags) ;(defines) "-c" from "-o" to "-pthread"]
(exec [(cc) (ccstd) ;(opt) ;(cflags) ;(extra-paths) "-fPIC" ;(defines) "-c" from "-o" to "-pthread"]
[from] [to] (string "compiling " from "...")))

(defn compile-c++
"Compile a C++ program to an object file. Return the command arguments."
[from to]
(exec [(c++) (c++std) ;(opt) ;(extra-paths) "-fPIC" ;(c++flags) ;(defines) "-c" from "-o" to "-pthread"]
(exec [(c++) (c++std) ;(opt) ;(cflags) ;(extra-paths) "-fPIC" ;(defines) "-c" from "-o" to "-pthread"]
[from] [to] (string "compiling " from "...")))

(defn link-shared-c
"Link a C program to make a shared library. Return the command arguments."
[objects to]
(exec [(cc) (ccstd) ;(opt) ;(extra-paths) ;(cflags) "-o" to ;objects "-pthread" ;(libs) "-shared"]
(exec [(cc) (ccstd) ;(opt) ;(cflags) ;(extra-paths) "-o" to ;objects "-pthread" ;(libs) "-shared"]
objects [to] (string "linking " to "...")))

(defn link-shared-c++
"Link a C++ program to make a shared library. Return the command arguments."
[objects to]
(exec [(c++) (c++std) ;(opt) ;(extra-paths) ;(c++flags) "-o" to ;objects "-pthread" ;(libs) "-shared"]
(exec [(c++) (c++std) ;(opt) ;(c++flags) ;(extra-paths) "-o" to ;objects "-pthread" ;(libs) "-shared"]
objects [to] (string "linking " to "...")))

(defn link-executable-c
"Link a C program to make an executable. Return the command arguments."
[objects to]
(exec [(cc) (ccstd) ;(opt) ;(extra-paths) ;(cflags) "-o" to ;objects ;(rdynamic) "-pthread" ;(libs)]
(exec [(cc) (ccstd) ;(opt) ;(cflags) ;(extra-paths) "-o" to ;objects ;(rdynamic) "-pthread" ;(libs)]
objects [to] (string "linking " to "...")))

(defn link-executable-c++
"Link a C++ program to make an executable. Return the command arguments."
[objects to]
(exec [(c++) (c++std) ;(opt) ;(extra-paths) ;(c++flags) "-o" to ;objects ;(rdynamic) "-pthread" ;(libs)]
(exec [(c++) (c++std) ;(opt) ;(c++flags) ;(extra-paths) "-o" to ;objects ;(rdynamic) "-pthread" ;(libs)]
objects [to] (string "linking " to "...")))

(defn make-archive
Expand Down

0 comments on commit 3348318

Please sign in to comment.