Skip to content

Commit 48bb497

Browse files
committed
Do not use target-specific variables
1 parent 59eedb6 commit 48bb497

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
- Fix makefile dependencies.
1717
- Fix makefile to use source directory for build dependencies.
1818
- Fix changelog to reflect v0.1.0 release.
19+
- Update makefile to not use target-specific variables.
1920

2021
## [0.1.0] - 2024-04-16
2122

Makefile.in

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,20 @@ CFLAGS = @CFLAGS@
1414
DEPFLAGS = -MT $@ -MMD -MP -MF $(@:.o=.d)
1515
VPATH = @srcdir@
1616

17+
SOURCE = @srcdir@
18+
19+
SOURCES = src/zone.c src/fallback/parser.c
20+
OBJECTS = $(SOURCES:.c=.o)
21+
1722
WESTMERE_SOURCES = src/westmere/parser.c
18-
WESTMERE_OBJECTS = $($(WESTMERE)_SOURCES:.c=.o)
23+
WESTMERE_OBJECTS = $(WESTMERE_SOURCES:.c=.o)
1924

2025
HASWELL_SOURCES = src/haswell/parser.c
21-
HASWELL_OBJECTS = $($(HASWELL)_SOURCES:.c=.o)
26+
HASWELL_OBJECTS = $(HASWELL_SOURCES:.c=.o)
2227

23-
SOURCE = @srcdir@
24-
SOURCES = src/zone.c src/fallback/parser.c
25-
NO_SOURCES =
26-
OBJECTS = $(SOURCES:.c=.o) \
27-
$($(WESTMERE)_SOURCES:.c=.o) \
28-
$($(HASWELL)_SOURCES:.c=.o)
29-
DEPENDS = $(OBJECTS:.o=.d)
28+
NO_OBJECTS =
29+
30+
DEPENDS = $(SOURCES:.c=.d) $(WESTMERE_SOURCES:.c=.d) $(HASWELL_SOURCES:.c=.d)
3031

3132
EXPORT_HEADER = include/zone/export.h
3233

@@ -44,24 +45,29 @@ distclean: clean
4445
realclean: distclean
4546
@rm -rf autom4te*
4647

47-
libzone.a: $(EXPORT_HEADER) $(OBJECTS)
48-
$(AR) rcs libzone.a $(OBJECTS)
48+
libzone.a: $(EXPORT_HEADER) $(OBJECTS) $($(WESTMERE)_OBJECTS) $($(HASWELL)_OBJECTS)
49+
$(AR) rcs libzone.a $(OBJECTS) $($(WESTMERE)_OBJECTS) $($(HASWELL)_OBJECTS)
4950

5051
$(EXPORT_HEADER):
5152
@mkdir -p include/zone
5253
@echo "#define ZONE_EXPORT" > include/zone/export.h
5354

54-
$(WESTMERE_OBJECTS): CFLAGS += -march=westmere
55-
$(HASWELL_OBJECTS): CFLAGS += -march=haswell
55+
$(WESTMERE_OBJECTS): .depend
56+
@mkdir -p src/westmere
57+
$(CC) $(DEPFLAGS) $(CPPFLAGS) $(CFLAGS) -march=westmere -o $@ -c $(SOURCE)/$(@:.o=.c)
58+
59+
$(HASWELL_OBJECTS): .depend
60+
@mkdir -p src/haswell
61+
$(CC) $(DEPFLAGS) $(CPPFLAGS) $(CFLAGS) -march=haswell -o $@ -c $(SOURCE)/$(@:.o=.c)
5662

5763
$(OBJECTS): .depend
58-
@mkdir -p src/fallback src/westmere src/haswell
64+
@mkdir -p src/fallback
5965
$(CC) $(DEPFLAGS) $(CPPFLAGS) $(CFLAGS) -o $@ -c $(SOURCE)/$(@:.o=.c)
6066
@touch $@
6167

6268
.depend:
6369
@cat /dev/null > $@
64-
@for x in $(OBJECTS:.o=); do echo "$${x}.o: $(SOURCE)/$${x}.c $${x}.d" >> $@; done
70+
@for x in $(DEPENDS:.d=); do echo "$${x}.o: $(SOURCE)/$${x}.c $${x}.d" >> $@; done
6571

6672
-include .depend
6773
$(DEPENDS):

0 commit comments

Comments
 (0)