Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rule to create object file in Makefile #2605

Open
wants to merge 2 commits into
base: onedrive-v2.5.0-release-candidate-2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ config.status
autom4te.cache/
contrib/pacman/PKGBUILD
contrib/spec/onedrive.spec
contrib/systemd/onedrive.service
contrib/systemd/onedrive@.service

*.o
38 changes: 27 additions & 11 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ DEBUG = @DEBUG@
DC = @DC@
DC_TYPE = @DC_TYPE@
DCFLAGS = @DCFLAGS@
DCFLAGS += -w -g -O -J.
DCFLAGS += -w -g -O -J. -Isrc -Isrc/notifications
ifeq ($(DEBUG),yes)
ifeq ($(DC_TYPE),dmd)
DCFLAGS += -debug -gs
Expand Down Expand Up @@ -65,6 +65,12 @@ RHEL = 0
RHEL_VERSION = 0
endif

ifneq ($(wildcard .git/HEAD),"")
VERSION = $(shell git describe --tags)
else
VERSION = $(version)
endif

SOURCES = \
src/main.d \
src/config.d \
Expand All @@ -73,7 +79,7 @@ SOURCES = \
src/qxor.d \
src/curlEngine.d \
src/onedrive.d \
src/sync.d \
src/syncEngine.d \
src/itemdb.d \
src/sqlite.d \
src/clientSideFiltering.d \
Expand All @@ -84,24 +90,34 @@ ifeq ($(NOTIFICATIONS),yes)
SOURCES += src/notifications/notify.d src/notifications/dnotify.d
endif

all: onedrive
# Object file
OBJ = $(SOURCES:.d=.o)

# Executable
EXE = onedrive

all: version $(EXE)

clean:
rm -f onedrive onedrive.o version
rm -f $(EXE) $(OBJ) version
rm -rf autom4te.cache
rm -f config.log config.status

# Remove files generated via ./configure
distclean: clean
rm -f Makefile contrib/pacman/PKGBUILD contrib/spec/onedrive.spec onedrive.1 $(system_unit_files) $(user_unit_files)

onedrive: $(SOURCES)
if [ -f .git/HEAD ] ; then \
git describe --tags > version ; \
else \
echo $(version) > version ; \
fi
$(DC) $(DCFLAGS) $(addprefix -L,$(curl_LIBS)) $(addprefix -L,$(sqlite_LIBS)) $(addprefix -L,$(notify_LIBS)) -L-ldl $(SOURCES) -of$@
version: $(SOURCES)
echo "$(VERSION)" > version;

$(EXE): $(OBJ)
$(DC) $(DCFLAGS) $(addprefix -L,$(curl_LIBS)) $(addprefix -L,$(sqlite_LIBS)) $(addprefix -L,$(notify_LIBS)) -L-ldl -of$@ $^

%.o: %.d
$(DC) $(DCFLAGS) -c $(addprefix -L,$(curl_LIBS)) $(addprefix -L,$(sqlite_LIBS)) $(addprefix -L,$(notify_LIBS)) -L-ldl -of=$@ $<

# ensure that version is ready
src/main.o: src/main.d version

install: all
$(INSTALL) -D onedrive $(DESTDIR)$(bindir)/onedrive
Expand Down
6 changes: 3 additions & 3 deletions src/notifications/dnotify.d
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module dnotify;
module notifications.dnotify;

private {
import std.string : toStringz;
Expand All @@ -7,10 +7,10 @@ private {
import std.variant : Variant;
import std.array : appender;

import deimos.notify.notify;
import notifications.notify;
}

public import deimos.notify.notify : NOTIFY_EXPIRES_DEFAULT, NOTIFY_EXPIRES_NEVER,
public import notifications.notify : NOTIFY_EXPIRES_DEFAULT, NOTIFY_EXPIRES_NEVER,
NotifyUrgency;


Expand Down
2 changes: 1 addition & 1 deletion src/notifications/notify.d
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Boston, MA 02111-1307, USA.
*/

module deimos.notify.notify;
module notifications.notify;


enum NOTIFY_VERSION_MAJOR = 0;
Expand Down
File renamed without changes.