Generate .c files instead of .h files

The files' contents haven't changed (other than some relative #include's
that refer to other .c files).

Some build systems have difficulty recognizing .h files as things to be
compiled, instead of just things referred to by things to be compiled.
This commit is contained in:
Nigel Tao committed 2018-12-22 15:29:00 +11:00
1 parent b0429923fc
commit 04c91f1410
24 files changed
+40 -49

No files matched your search

+2 -2
View File
@@ -83,11 +83,11 @@ var (
func genObj(outDir string, inDir string, cc string, dynamism string, filenames []string) error {
for _, filename := range filenames {
in := filepath.Join(inDir, filename+".h")
in := filepath.Join(inDir, filename+".c")
out := genlibOutFilename(outDir, dynamism, filename)
args := []string(nil)
args = append(args, "-x", "c", "-O3", "-std=c99", "-DWUFFS_IMPLEMENTATION")
args = append(args, "-O3", "-std=c99", "-DWUFFS_IMPLEMENTATION")
if dynamism == "dynamic" {
args = append(args, "-fPIC", "-DPIC")
}
+2 -2
View File
@@ -416,9 +416,9 @@ func (g *gen) genIncludes(b *buffer) error {
}
sort.Strings(usesList)
b.writes("#include \"./wuffs-base.h\"\n")
b.writes("#include \"./wuffs-base.c\"\n")
for _, use := range usesList {
b.printf("#include \"./wuffs-%s.h\"\n",
b.printf("#include \"./wuffs-%s.c\"\n",
strings.Replace(use, "/", "-", -1))
}
+3 -3
View File
@@ -53,7 +53,7 @@ func doGenrelease(args []string) error {
// Calculate the base directory.
baseDir := ""
for _, filename := range args {
if filepath.Base(filename) != "wuffs-base.h" {
if filepath.Base(filename) != "wuffs-base.c" {
continue
}
baseDir = filepath.Dir(filename)
@@ -188,7 +188,7 @@ func (h *genReleaseHelper) parse(relFilename string, s []byte) error {
f.fragments[1] = s[:i]
}
if relFilename == "wuffs-base.h" && (h.version != cf.Version{}) {
if relFilename == "wuffs-base.c" && (h.version != cf.Version{}) {
if subs, err := h.substituteWuffsVersion(f.fragments[0]); err != nil {
return err
} else {
@@ -254,7 +254,7 @@ func (h *genReleaseHelper) gen(w *bytes.Buffer, relFilename string, which int, d
func (h *genReleaseHelper) substituteWuffsVersion(s []byte) ([]byte, error) {
ret := []byte(nil)
if i := bytes.Index(s, grVOverride); i < 0 {
return nil, fmt.Errorf("could not find %q in %s", grVOverride, "wuffs-base.h")
return nil, fmt.Errorf("could not find %q in %s", grVOverride, "wuffs-base.c")
} else {
ret = append(ret, s[:i]...)
s = s[i+len(grVOverride):]